Utilizing JSONP, I have successfully retrieved a list of words from an external source to randomly select one for use in a game. The current source being used is as follows:
function processResult(obj) {
console.log(obj);
var data = JSON.stringify(obj);
console.log(data);
}
var script = document.createElement('script');
script.src = 'http://testhangmangame.net76.net?jsonp=processResult';
document.body.appendChild(script);
I am curious about the feasibility and method for extracting a single word from that string. Thank you in advance!
Sample JSON response:
{
"words": [
"Finitely",
"Misleading",
"Dinning",
"Energizing",
"Untruest",
"Menorah",
"Ghoulish",
"Realism",
"Caliphate",
"Buttercup",
"Oratorio",
"Prefix",
"Gaming",
"Preshrunk",
"Harmed",
"Loop",
"Banknote",
"Doily",
"Rest of words removed"
]
}
This JSON is enclosed within processResult( ... );
.