Last active
October 31, 2017 04:44
-
-
Save vickonrails/b40918135c4fd48f2e248b695d873a03 to your computer and use it in GitHub Desktop.
This file contains 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
function handleRequest(){ | |
if(this.readyState == 4 && this.status == 200){ //Explain this in a bit. | |
console.log(JSON.parse(request.responseText)); | |
} | |
} | |
var url; | |
url = "https://api.unsplash.com/search/photos/?query=home"; //We are searching for the query home. | |
var request = new XMLHttpRequest(); | |
request.onreadystatechange = handleRequest; | |
request.open('GET',url,true); | |
request.setRequestHeader('Authorization','Client-ID your-client-id'); // Unique client ID. | |
request.send(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment