Posted By

geneticcode on 10/19/14


Tagged

get http ajax XMLHttpRequest callback xhr


Versions (?)

XHR GET Request W/ Callback


 / Published in: JavaScript
 

Make a simple XHR Request:

get(url, function(resp)(){ window.alert(resp); });

Source is minified.

  1. function get(b,a){var c=(window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){a(c.responseText)}};c.open("GET",b,true);c.send()};

Report this snippet  

You need to login to post a comment.