detecting HTTP error using ajax
-
12-11-2019 - |
Question
I'm using ajax calls to retrieve some HTML data. In certain cases, there are chances that I may get HTTP error 403 (because of some IE bug Encountering 403 error while using ajax call on IE, Hash fragments with forward-slash throwing 403 errors with AJAX requests in IE).
For error handling purposes, I want to catch what error has occured and accordingly display some error message.
How do I do that?
Maybe something like
$.ajax({
type : 'POST',
data : data,
cache : false,
url : url,
dataType : 'html'
success : function(){
//if HTTP response is ok, diplay data
//else if HTTP response gets 403 error, display some other message
}
});
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow