I want to add extra data after i use $('#myForm').serialize() + extra data
$.ajax({ type: 'POST', url: $('#myForm').attr('action'), data: $('#myForm').serialize(), // I WANT TO ADD EXTRA DATA + SERIALIZE DATA success: function(data){ alert(data); $('.tampil_vr').text(data); } });
jQuery serialize() MethodThe serialize() method creates a URL encoded text string by serializing form values. You can select one or more form elements (like input and/or text area), or the form element itself. The serialized values can be used in the URL query string when making an AJAX request.
Data serialization is the process of converting an object into a stream of bytes to more easily save or transmit it. The reverse process—constructing a data structure or object from a series of bytes—is deserialization.
In JavaScript, for example, you can serialize an object to a JSON string by calling the function JSON. stringify() . CSS values are serialized by calling the function CSSStyleDeclaration. getPropertyValue() .
What kind of data?
data: $('#myForm').serialize() + "&moredata=" + morevalue
The "data" parameter is just a URL encoded string. You can append to it however you like. See the API here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With