I have a wrapper function used to send requests to the server, I need to do something specific if the server returns a 401 code, and I'm not sure how to get this data
$.mobile.showPageLoadingMsg(); $.post(apiUrl+method,p,function(d) { $.mobile.hidePageLoadingMsg(); console.log(d.success); console.log(d.message); if(d.success == true){ window[callback](d.data); } else{ if(d.message != null){ alert(d.message); } } },'json') .error(function() {
If my server-side code throws a 401 exception, the jquery.error function selects this only because its not 200, but I need to check if there is a 401 code.
Brian
source share