I want to post some additional data alongside serialized data i got from user form input.
For instance,
$.post(\'update.php\', $(\"#theform\").serial
you can do:
var data = $('#theform').serializeArray();
data.push({cposition: swidget});
//then
$.post('update.php', data, function(data) {
});
The jQuery serialize
function yields its values in the &key=value
format. It does this using $.param
internally. You would be able to append your own values in the same manner:
$.post('update.php', [$('#theform').serialize(), $.param({cposition:swidget})].join('&'), function(data) { ... });
You can append something to the end of serialized string.
$.post('update.php', $("#theform").serialize() + '&cposition:swidget', function(data) {
});