If you want to send some extra data (key/values) to the server while submitting an HTML form using jQuery Ajax function then its can be achieved by appending your query string data parameter,
Code Snippet$.ajax({
url: "../server-url.php",
type: "POST",
async: true,
cache: false,
data: $('form').serialize() + "&key1="+ value1 + "&key2=" +
document.getElementById("field").value,
success : function(val){
alert("Success!");
}
});
After $('form').serialize() I have just appended the data as query String.
More Posts related to JavaScript,
- How to get UTC (GMT) time using JavaScript
- Submit html form on dropdown menu value selection or change using javascript
- How to detect Browser and Operating System Name and Version using JavaScript
- JavaScript : Get current page address
- [javaScript] Convert text case to lowercase
- How to check if a String contains substring or a word using javaScript
- Writing your first Hello, World! 🌍 JavaScript code Tutorial
- JavaScript: Check if variable is a number
- How to send email from JavaScript HTML using mailto
- Meaning of javascript:void(0) explained with example
- How to get query string in JavaScript HTML location.search
- Javascript convert text case from uppercase to lowercase
- Loading previous page using html button using JavaScript
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- How to get current URL Location using Javascript HTML
- Detect if Cookies are enabled using JavaScript
- Write javaScript code in Swedish using FikaScript
- Add Animated Scrolling to Html Page Title Script
- JavaScript: Convert an Image into Base64 String
- Remove items from JavaScript array
- Send Extra Data with Ajax Get or Post Request
- How to Print from JavaScript HTML using window.print
- Get Device Screen Width and Height using javaScript
- Examples: Convert String to int in JavaScript
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
More Posts:
- How to List all Packages installed using pip [Python] - Python
- Android App Showing Two Toolbars Issue fix - Android
- [Solved] SharePoint Access Denied error editing Document Name - SharePoint
- Install Native Golang on M1/M2 ARM based Mac - MacOS
- Fetch More then 10 Links Per Page in Google Search Result - Google
- git command to remove/unstage files from staging area - Git
- How to create volume in Docker using Command - Docker
- How to Install MongoDB in VSCode - HowTos