When using ajax, you often need to assemble the input data in the form of 'name=abc&sex=1'. This work can be easily completed using JQuery's serialize method!
jQuery ajax - serialize() method definition and usageserialize() method creates a URL-encoded text string by serializing form values.
You can select one or more form elements (such as inputs and/or text boxes), or the form element itself.
Serialized values can be used in URL query strings when generating AJAX requests.
jQuery ajax - serialize() method syntax
$(selector).serialize()
jQuery ajax - serialize() method detailed description
.serialize() method is created with A text string represented in standard URL encoding. It operates on a jQuery object that represents a collection of form elements.
jquery ajax - serialize() method There are several types of form elements: