dc

dc

  • NA
  • 663
  • 0

ajax error handling logic

Aug 27 2016 1:30 PM
In 2 ajax calls that are listed below, there are 2 places that say 'error: AjaxFailed'.
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: document.location.pathname + "/GetStudentLetter",
data: "{ " + strData + " }",
dataType: "json",
success: function (data) {
LoadEditor(JSON.parse(data.d), milestone);
},
error: AjaxFailed
});
if (milestone == '999') {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: document.location.pathname + "/Gettattschyr",
data: "{ " + strData + " }",
dataType: "json",
success: function (data) {
successtest(eval(data));
},
error: AjaxFailed
});
}
}
function successtest(sletter) {
var sle = sletter
_txtattschyr = sletter.d
if (_txtattschyr > '1') {
alert('You have selected student(s) having more than one Entry for the current school year. ');
return
}
I would like to have better error handling so that I know what is exactly wrong. From the first ajax call, I got a 500 server error problem
in production. By guessing, I found out that I needed to increase the maximum size of the jason file that is posted above.
Thus can you tell and/or point me to urls that will show me better error logic that I can use?

Answers (4)