Created
August 19, 2015 10:46
-
-
Save deanhume/1655f7a0c5a93727e90a 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(); |
alexsndf
commented
Sep 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment