jquery Ajax using Serialize () Form field too many fields can not send all, instead of using the Serializearray () method, and then check the use of the method, there is no problem for the time being found
such as: {Name: ' Extract heavenly Stars ', Position: ' It technology '}// PS: note put the same name in an array Function getformjson (form) { var o = {}; var a = $ (Form). Serializearray (); $.each (a, function () { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push (this.value | | "); } else { o[this.name] = this.value | | "; } }); return o;} Debug Calls $ (function () { $ ("#button"). Click (function () { alert (Getformjson (" #formID ")); }); /ajax Submit $.ajax ({ type: "POST", uRL: "ajax.php", data:getformjson ($ ("#formID")),///form data JSON Format function parameter fill in the form ID or form to be submitted datatype: ' JSON ', success: function (msg) {alert (msg)}, error: function (Error {alert (error);}});
Code Source: Http://www.tuicool.com/articles/NJFnEnz
jquery Ajax uses serialize () to cause problems with too many form fields