Created
March 28, 2017 21:40
-
-
Save aajjbb/58f1417886cb567ddac0acc6c585641c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "https://api.github.com/repos/awesomeWM/awesome/issues/1395/comments" | |
var httpRequest | |
window.document.onload = function makeRequest(url) { | |
httpRequest = new XMLHttpRequest() | |
if (!httpRequest) { | |
console.log('Browser do not support an ajax call.') | |
return false | |
} | |
httpRequest.onreadystatechange = callHandler | |
httpRequest.open('GET', url) | |
httpRequest.send() | |
} | |
function worker(data) { | |
for (var comment in data) { | |
body = comment.body | |
console.log(body) | |
} | |
} | |
function callHandler() { | |
if (httpRequest.readyState === XMLHttpRequest.DONE) { | |
if (httpRequest.status === 200) { | |
worker(JSON.parse(httpRequest.responseText)) | |
} else { | |
console.log('There was a problem with the request.') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment