Created
September 3, 2017 16:39
-
-
Save khaosdoctor/4828725ba7dcc251923b7d8d743ab963 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var request = new XMLHttpRequest(); | |
request.open(‘GET’, ‘/my/url’, true); | |
request.onload = function() { | |
if (this.status >= 200 && this.status < 400) { | |
// Sucesso! | |
var resp = this.response; | |
} else { | |
// Alcançamos o servidor, mas tivemos um erro | |
} | |
}; | |
request.onerror = function() { | |
// Erro de conexão | |
}; | |
request.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment