Everytime I run my ajax jquery function I get an error, this goes for all my ajax calls. here is an example of my code
function FindContact(CompanyName,DivisionName,FirstName,LastName) {
$.ajax({
url: 'Path',
dataType: "json",
async:false,
type:'post',
data: {'FirstName':FirstName,'LastName':LastName,'DivisionName':DivisionName,'CompanyName':CompanyName},
success: DisplayContacts,
error: ErrorMsg
});
}
to get around this I use this
function ErrorMsg(result) {
if (result.status == 200 && result.statusText == 'OK') {
DisplayContacts(result);
}
else {
alert("FAILED : " + result.status + ' ' + result.statusText);
}
}
this is tough because I need to create method like this for every ajax request.
why does it run the error code 1st???
Please help!