Created
August 15, 2022 20:07
-
-
Save JonathanMatthey/98597fb6d7a733b4236171bce6408e42 to your computer and use it in GitHub Desktop.
rainforestQA-follow function
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 getJSON = function(url, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
xhr.responseType = 'json'; | |
xhr.onload = function() { | |
var status = xhr.status; | |
if (status === 200) { | |
callback(null, xhr.response); | |
} else { | |
callback(status, xhr.response); | |
} | |
}; | |
xhr.send(); | |
}; | |
function follow(data){ | |
console.log(data); | |
if(data.follow) | |
getJSON(data.follow.replace('challenge','challenge.json'), function(status,data){follow(data)}) | |
} | |
follow({follow:"https://www.letsrevolutionizetesting.com/challenge"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment