You must add a timeout parameter in an $.ajax() call to be able to handle 404 errors!