jquery serialize form data to json code example
Example 1: how take values from JSON.stringify($('form').serialize())
1 var formData = $('#form').serializeObject();
2 $.extend(formData, { Contacts : myContacts});
3 $.extend(formData, { Address : myAddress});
4 var result = JSON.stringify(formData);
5
Example 2: jquery form serialize object
$(function(){
$('form').on('submit', function(e){
e.preventDefault();
$(this).serializeObject().done(function(o){
if(window.console) console.log(o);
var j = JSON.stringify(o);
alert(j);
//window.open("data:image/png;base64," + o.userfile.data);
});
});
});