-
-
Save onur-km/c8408eb4142562e61dff3d6b997c6a7d to your computer and use it in GitHub Desktop.
A simple XHR request
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
function successListener() { | |
var data = JSON.parse(this.responseText); | |
console.log(data); | |
} | |
function failureListener(err) { | |
console.log('Request failed', err); | |
} | |
var request = new XMLHttpRequest(); | |
request.onload = successListener; | |
request.onerror = failureListener; | |
request.open('get', './api/some.json', true); | |
request.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment