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,
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
- How to send email from JavaScript HTML using mailto
- Write javaScript code in Swedish using FikaScript
- [javaScript] Convert text case to lowercase
- Detect if Cookies are enabled using JavaScript
- How to get query string in JavaScript HTML location.search
- Remove items from JavaScript array
- JavaScript date in yyyy-MM-dd format
- Send Extra Data with Ajax Get or Post Request
- Get Device Screen Width and Height using javaScript
More Posts:
- Unsupported major.minor version 52.0 in java - Java
- Default speed of Marquee tag : SCROLLAMOUNT - Html
- How to take Screenshots on Mac OS X without Keyboard - Mac-OS-X
- Create Bootstrap carousel slider with Text - Bootstrap
- W3 HTML validator warning Unable to Determine Parse Mode - Html
- How to update SharePoint List Item programmatically - SharePoint
- How to delete SharePoint List Item programmatically - SharePoint
- 21 Useful Android Emulator Short-cut Keyboard Keys - Android
- 4 Open Source SQLite Editor for Mac OS X , Windows and Linux - Mac-OS-X
- CentOS Cannot find a valid baseurl for repo base7x86_64 yum - HowTos
- PHP Fatal error : Call to a member function bind_param() on a non-object - PHP
- align image at middle of div element - CSS
- Detect if Cookies are enabled using JavaScript - JavaScript
- Warning: Cannot modify header information - headers already sent - PHP
- AlertDialog with single button example : Android - Android