Functions used together with jqueryserializeArray () are mainly used to conveniently submit forms. For more information, see. . SerializeArray () serializes table elements (similar to the '. serialize ()' method) and returns JSON data structure data. (From the jquery document ).
There is a form window with the code:
The Code is as follows:
JavaScript code Processing Form:
The Code is as follows:
Script
$ (Function (){
$ ("# Butsubmit"). click (function (){
Var data = convertArray ($ ("# tf"). serializeArray ());
$. Post (url, data, function (d) {}, "json ");
});
})
Function convertArray (o) {// mainly recommends this function. It converts the serialized value of jquery into the name: value format.
Var v = {};
For (var I in o ){
If (typeof (v [o [I]. name]) = 'undefined') v [o [I]. name] = o [I]. value;
Else v [o [I]. name] + = "," + o [I]. value;
}
Return v;
}
Script