Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function httpGetAsync(theUrl, callback) {
- var xhr = new XMLHttpRequest();
- var argsToCallback = Array.prototype.slice.call(arguments, 2);
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4 && xhr.status === 200) {
- var args = [JSON.parse(xhr.responseText)];
- args = args.concat(argsToCallback);
- callback.apply(this, args);
- } else {
- console.log("Status de la r�ponse:" + this.status, this.statusText);
- }
- }
- xhr.open("GET", theUrl, true);
- xhr.send(null);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement