I want to Fetch a json to display only syn in a div.
its like:–
$.getJSON('http://words.bighugelabs.com/api/2/eba286cdc7f3619674544d80ce94cb1b/stack/json', function(data) {
//parse the response to display in a div
});
JSON markup from link:
{
"noun": {
"syn": [
"batch",
"deal",
"flock",
"good deal",
"great deal",
"hatful",
"heap",
"lot",
"mass",
"mess",
"mickle",
"mint",
"muckle",
"peck",
"pile",
"plenty",
"pot",
"quite a little",
"raft",
"sight",
"slew",
"spate",
"tidy sum",
"wad",
"push-down list",
"push-down stack",
"smokestack",
"push-down storage",
"push-down store",
"agglomerate",
"chimney",
"cumulation",
"cumulus",
"large indefinite amount",
"large indefinite quantity",
"list",
"listing",
"memory device",
"mound",
"storage device",
"whole lot",
"whole slew"
]
},
"verb": {
"syn": [
"pile",
"heap",
"arrange",
"lade",
"laden",
"load",
"load up",
"set up"
],
"rel": [
"heap up",
"pile up",
"stack away",
"stack up"
]
}
}
The JSON fails to load because of the Same Origin Policy, just append
?callback=?to your world and it’d work. The updated code,Update:
And when you append a
?callback=?to the URL used in$.getJSON, jQuery understands that it’s a JSONP request and not a XMLHttpRequest to fetch JSON. Actually the callback parameter can be anything thing, but the value must be?to trigger a JSONP request.When making the request jQuery replaces the parameter something as
?callback=jQuery15107307685413397849_1299439987443, the value will be unique every time you make a request.