Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Last active December 19, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/5895573 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/5895573 to your computer and use it in GitHub Desktop.
typical (bad) ajax worker, idiomatically
function paralellAjax(url){
var quickAjax = function(url,callback){
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function(resp){
if(ajax.readyState === 4 && ajax.status === 200) {
calback(JSON.stringify(ajax.response));
}
}
ajax.open('GET',url,true);
ajax.send();
}
return cw(quickAjax,url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment