i noticed that when i provide an invalid URL to get() i get no errors
$.get(nextHref, function(data, status, xhr) {
alert(status);
if (status == "error") {
alert("an error has occured: " + xhr.status + " " + xhr.statusText);
}
alert(status); nv even runs when i provide an invalid URL
The
$.get()callback is a success function, so this will never run on error, you can either use$.ajax()for the full version, or rig up a global error event handler, whichever is more appropriate.If you want to use
$.ajax(), use theerrorcallback, like this:Or use the global event handler
$().ajaxError()like this:Or, use
$.ajaxSetup()to add anerrorhandler for all requests, like this: