Skip to content

Instantly share code, notes, and snippets.

@christian-fei
Created January 6, 2014 11:36
Show Gist options
  • Save christian-fei/8281582 to your computer and use it in GitHub Desktop.
Save christian-fei/8281582 to your computer and use it in GitHub Desktop.
Hey Kevin, I read you post about jekyll and bullgit. You mentioned you got the response twice when doing the xmlhttprequest. It may be because your are not 'waiting long enough'. Maybe (certainly) the code below explains it better
var xml = new XMLHttpRequest();
//async, coz Ajax
xml.open("GET", "https://api.github.com/orgs/bullgit/repos", true);
xml.onreadystatechange = function() {
//see this link for more info about readyState http://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp
if (xml.status==200 && xml.readyState==4){
//your code
}
};
xml.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment