I am trying to figure out how to append two more values to the serialize method in JQuery. I have the following code to submit a form with ajax and have two more variables that I would like to append:
Thank you!
...
var formData = $('#contact_form').serialize();
submitForm(formData);
// -----------------------------------------------
// AJAX FORM SUBMIT
// -----------------------------------------------
function submitForm(formData){
$.ajax({
type: 'POST',
url: 'contact.php',
data: formData,
dataType: 'json',
cache: false,
timeout: 7000,
success: function(data) {
// display success message
response(data.msg,'show');
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
...
},
complete: function(XMLHttpRequest, status) {
...
}
});
}