Back

JQuery add more data to serialized data for AJAX

added on :: 3 July 2014

So if you get a serialized hash from a form submission or other means and want to add more information before you you send it to your headache free server; please do as bellow ':data' section


 

$.ajax({
type: 'post',
url: "http://iamfree.com/nice_day",
data: $(this).sortable('serialize') + '&user_id=' + the_var +'&location=Melbourne' ,
dataType: "script",
complete: function(request){
$('#sortable').effect('highlight');
},

}
});
or
 
 data: var_serialized_data + '&hello=you&nice=Day&whats=dinner&fancy=muffins',

if it is form submit

var formInfo =$( this ).serialize() + '&user_id=' + the_var
and to log with new info:

console.log(formInfo);

Back