Created
June 25, 2018 16:00
-
-
Save Troland/d4ad9790551af08a2899e5f84956f01a to your computer and use it in GitHub Desktop.
jquery ajax error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
type: 'GET', | |
url: {url}, | |
success: function(data) { | |
alert('Success'); | |
}, | |
error: function(xhr, textStatus, errorThrown) { | |
if (xhr.readyState == 4) { | |
// HTTP error (can be checked by XMLHttpRequest.status and XMLHttpRequest.statusText) | |
} else if (xhr.readyState == 0) { | |
// Network error (i.e. connection refused, access denied due to CORS, etc.) | |
} else { | |
// something weird is happening | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment