Last active
December 1, 2016 07:06
-
-
Save kim-codes/3287c5b82e846676836298044c3ee2a1 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
data = null; | |
xhr = null; | |
xhr = new XMLHttpRequest(); | |
xhr.withCredentials = true; | |
xhr.addEventListener("readystatechange", function () { | |
if (this.readyState === this.DONE) { | |
jsonText = JSON.parse(xhr.responseText); | |
wordDefinition = jsonText.results[0].lexicalEntries[0].entries[0].senses[0].subsenses[0].definitions[0]; | |
console.log(jsonText.results[0].lexicalEntries[0].entries[0].senses[0].subsenses[0].definitions[0]); | |
} | |
}); | |
xhr.open("GET", "https://od-api.oxforddictionaries.com:443/api/v1/entries/en/"+wordToSearch+'/definitions', false); | |
xhr.setRequestHeader("accept", "application/json"); | |
xhr.setRequestHeader("app_id", "xxxx"); | |
xhr.setRequestHeader("app_key", "xxxx"); | |
xhr.send(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment