Serialize () The table contents of the sequence table are strings for Ajax requests.
Serializearray () Serializes tabular elements (similar to the '. Serialize () ' method) to return the JSON data structure.
. Serializearray ()
Encodes a set of form elements as an array of "Name attribute value/value property value". JSON structure, such as:
[ { name:a 1 }, { name:b 2 }, { name:c 3 }, { name:d 4 }, { name:e 5 }] . Serialize ()
Encodes a set of form elements as a filled string. The string is a standard URL encoding. Such as:
A=1&b=2&c=3&d=4&e=5
<form> <!--can be extracted by JSON array, URL string data type--<input type= "text" Name= "a" value= "1" id= "a"/> <inp UT type= "text" name= "B" value= "2" id= "B"/> <input type= "hidden" name= "C" value= "3" id= "C"/> <textarea Name= "D" rows= "8" cols= ">4</textarea> <select name=" E "> <option value=" 5 "selected=" sel ected ">5</option> <option value=" 6 ">6</option> <option value=" 7 ">7</op tion> </select> <input type= "checkbox" Name= "F" value= "8" id= "F1" checked= "checked"/> & Lt;input type= "checkbox" Name= "F" value= "9" id= "F2"/> <input type= "Radio" name= "G" value= "ten" id= "G1"/> <input type= "Radio" name= "G" value= "one" checked= "checked" id= "G2"/> <input type= "password" name= "H" maxl Ength= "8" value= "H"/> <!--can not be extracted by JSON, URL string data type--<input type= "Submit" name= "I" value= "Submi T "id=" I "/> ≪input type= "button" Name= "J" value= "click Me" onclick= "msg ()"/> <input type= "file" Name= "K"/><br/ > <input type= "reset" value= "reset" name= "L"/> <input type= "image" Src= "/i/eg_submit.jpg" alt= "Submit"/></form><p><tt id= "Results" ></tt></p><script>functionshowvalues () {varFields = $ (": Input"). Serializearray (); $("#results"). empty (); Jquery.each (Fields,function(i, field) {$ ("#results"). Append (Field.value + ""); }); } $(": CheckBox,: Radio"). Click (showvalues); $("Select"). Change (ShowValues); ShowValues ();</script><script>functionshowvalues () {varstr = $ ("form"). Serialize (); $("#results"). text (str); } $(": CheckBox,: Radio"). Click (showvalues); $("Select"). Change (ShowValues); ShowValues ();</script>
Serializearray () and serialize ()