as the title says I'm sending some post data via ajax. but I keep on getting errors, can anyone take a look at the code and explain why my ajax call keeps failing?
submitForm(jQuery('#priceCalc'), {name: 'thingdoto', value: "true"});
function submitForm(form, data) {
var postData = form.serializeArray(),
formURL = form.attr("action");
postData.push(data);
console.log(postData);
jQuery.ajax({
url : formURL,
type: 'POST',
dataType : "json",
data: postData,
success:function(data)
{
jQuery('#priceTotal').html(data);
},
error: function()
{
jQuery('#priceTotal').html('error');
}
});
}
EDIT: The ajax call returns the error, so it's just not succeeding. Don't know why.