I've used JSONP to fetch data from another source which returns a list of words to randomly take one out of which is to be used in a game... my source for this as it stands is;
function processResult(obj) {
console.log(obj);
var blah = JSON.stringify(obj);
console.log(blah);
}
var jsonp = document.createElement('script');
jsonp.src = 'http://testhangmangame.net76.net?jsonp=processResult';
document.body.appendChild(jsonp);
I was wondering, if and how is it possible to extract one word from that string thanks in advance!
Example of json returned:
{
"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 wrapped in processResult( ... );
.