Last active
September 7, 2019 14:23
-
-
Save dev-tim/e92649617be1141368aafb63917dc38d to your computer and use it in GitHub Desktop.
xhr
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
| function get(url, callback) { | |
| var xhr = new XMLHttpRequest(); | |
| xhr.onreadystatechange = function() { | |
| if (xhr.readyState == XMLHttpRequest.DONE) { | |
| callback(xhr.responseText) | |
| } | |
| } | |
| xhr.open('GET', url, true); | |
| xhr.send(null); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment