Source: Https://github.com/macek/jquery-serialize-object
Please look at the Jquery-serialize-object-master.zip in the file.
There is a file: Jquery.serialize-object.js, which is used to format the form data in JSON.
Usage:
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title></Head><Scripttype= "Text/javascript"src= "Js/jquery-1.11.1.min.js"></Script><Scripttype= "Text/javascript"src= "Js/jquery.serialize-object.js"></Script><Body><formID= "Contact"> <inputname= "User[email]"value= "[email protected]"> <inputname= "user[pets][]"type= "checkbox"value= "Cat"checked> <inputname= "user[pets][]"type= "checkbox"value= "Dog"checked> <inputname= "user[pets][]"type= "checkbox"value= "Bird"> <inputtype= "Submit"></form></Body></HTML> <Scripttype= "Text/javascript"> varo= $('form#contact'). Serializejson (); Console.log (o)
{"User": {"email": "[email protected]", "Pets": ["Cat", "Dog"]}} </Script>
Encapsulate form data into JSON format plug-in available