json - Convert form data to JavaScript object with jQuery -
How can I convert all the elements of my form to a JavaScript object?
Without looping on each element, I have a way to automatically create a JavaScript object from my form. I do not want any string, as given by $ ('# formid') has gone. Serialize ();
, and I do not want to return the map by $ ('# formid'). SerializeArray ();
Already completely fine. You just need to massage the data in your required format:
function object (form ARRA) {// serialize data function var returnArray = {}; (Var i = 0; i & lt; formArray.length; i ++) {return arrow [farmer [i] ['name']] = formarere [i] ['value']; } Return back; }
Look for hidden areas that name the actual inputs, because they will be overwritten.
Comments
Post a Comment