javascript - JSON call back function name in getJSON() -
i want access reactome rest api retrieve data. using getjson()
json
data. don't know callback function name
name different every websites.
following not working:
$.getjson('http://reactomews.oicr.on.ca:8080/reactomerestfulapi/restfulws/frontpageitems/homo+sapiens?jsoncallback=?', function(data) { console.dir(data); });
i tried using ajax since jquery documentation states can leave on jquery decide callback function.
$.ajax({ type: 'get', url: 'http://reactomews.oicr.on.ca:8080/reactomerestfulapi/restfulws/frontpageitems/homo+sapiens', datatype: 'jsonp', success: function(data) { console.dir(data); }, error: function(e) { console.log("error");
all signs point service not supporting jsonp.
the actual error in jquery being: typeerror: property 'message' of object error: jquery191005664544063620269_1366270377427 not called not function
.
examining response server when issuing jsonp request, not wrapped in callback function. returns this...
[ { "dbid" : 109581, "displayname" : "apoptosis", "created" : { "dbid" : 109608, ....
but support jsonp need instead like:
jquery191005664544063620269_1366270377427([ { "dbid" : 109581, "displayname" : "apoptosis", "created" : { "dbid" : 109608, ....)
you'll need find different way deal same origin security restrictions.
the simplest option might use server-side proxy instead of going direct via browser. in other words, jquery call server under own control (preferably on same domain serving html), , pass service request on , provide appropriate response. or if don't need dynamic on client, server-side script whole thing (asp.net, php, etc.)
Comments
Post a Comment