Advertisement
TheTintin

Untitled

May 30th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. function httpGetAsync(theUrl, callback, caller) {
  2. var xhr = new XMLHttpRequest();
  3.  
  4. xhr.onreadystatechange = function() {
  5. if (xhr.readyState === 4 && xhr.status === 200) {
  6. callback.apply(caller, [JSON.parse(xhr.responseText)]);
  7. } else {
  8. console.log("Status de la r�ponse:" + this.status, this.statusText);
  9. }
  10. }
  11. xhr.open("GET", theUrl, true);
  12. xhr.send(null);
  13. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement