The ajax post hits the server and delivers the correct information, but even though it works it still is hitting the error function. The ready state is 0, so it says it isn't even making the request.
var serviceURL = '/ContactForm/FirstAjax';
$.ajax({
type: "POST",
url: serviceURL,
data: JSON.stringify(formInfo),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
alert("Worked");
},
error: function (xhRequest, ErrorText, thrownError) {
alert("Failed to process correctly, please try again" + "\n xhRequest: " + xhRequest + "\n" + "ErrorText: " + ErrorText + "\n" + "thrownError: " + thrownError);
}
});
The error message is:
My controller looks like this:
[HttpPost]
[ActionName("FirstAjax")]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public JsonResult FirstAjax(ContactForm contactForm)
{
return Json("works", JsonRequestBehavior.AllowGet);
}