Reputation: 3930
I am using a JQuery in an MVC appliaction post that is erroring out, is there someway to tell what the error is?
Example code -
$.post("/Path/Action", form, function (returnHtml) {
//do stuff
}).error(function () { alert("error"); });
I have attached the ".error" call but that doesn't tell me the cause of the error. Thanks!
Upvotes: 0
Views: 79
Reputation: 207501
Hopefully you debugged it on your own based on my comment, but you can get the info this way
$.post("/error/").error( function(xhrObject,statusName,statusText) {
console.log(xhrObject,statusName,statusText); //Passed in info via arguments
console.log(xhrObject.status); //get the status code via the xhr object
});
Upvotes: 1
Reputation: 17288
$.ajax({
type: 'POST',
url: '/Path/Action',
data: form,
success: function (data) {
console.debug(data);
},
error: function (data) {
console.debug(data);
}
});
Upvotes: 1
Reputation: 3657
.error( function (jqXHR, status, error) {
alert(jqXHR);
alert(status),
alert(error);
})
Upvotes: 1