Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get form data as object jquery

var paramObj = {};
$.each($('#myForm').serializeArray(), function(_, kv) {
  if (paramObj.hasOwnProperty(kv.name)) {
    paramObj[kv.name] = $.makeArray(paramObj[kv.name]);
    paramObj[kv.name].push(kv.value);
  }
  else {
    paramObj[kv.name] = kv.value;
  }
});
 
PREVIOUS NEXT
Tagged: #form #data #object #jquery
ADD COMMENT
Topic
Name
4+8 =