add additional data to $form.serialize() ajax post?

Perhaps a better solution to this might be to use jQuery's serializeArray, as suggested by this answer:

var data = $form.serializeArray();
data.push({name: 'hours', value: selectedHours});

$.post('/process/somepage.php', data).done(doSomething);

This solution might be preferable because it avoids manually constructing a serialized data string, instead opting to passing the data on for jQuery to deal with.


try this:

$.ajax({ 
    type: 'post',
    url: '/process/somepage.php',
    data: $form.serialize() + '&hours=' + JSON.stringify(selectedHours),
    dataType : 'json'
}).done(function (response) {
... and so on...

data sended are just a URL encoded string. You can append other value with a simple concatenation.