I'm trying to use json data from the search api with Javascript, loading it by a <script> tag as follows: var url = "http://api.amp.active.com/search?callbackMethod=dataFunction&k=cycling&l=52241&r=100&v=json&api_key={api-key}"; var scriptBlock = document.createElement('script'); scriptBlock.src = url; scriptBlock.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(scriptBlock); From my understanding, writing the url in this way is supposed to generate the returned search json object inside a call to dataFunction, e.g.: dataFunction(jsonSearchResultObject) But your API only returns the jsonSearchResultObject, with no callback. Is there any way to get the desired functionality from your API? Thanks. Dave
Message edited by dave 15 years ago
active Admin – 15 years ago
try using "cb=dataFunction" instead of "callbackMethod=dataFunction". Let me know how you go.
dave – 15 years ago
Perfect - thanks! Dave
Please sign in to add a post.
I'm trying to use json data from the search api with Javascript, loading it by a <script> tag as follows:
var url = "http://api.amp.active.com/search?callbackMethod=dataFunction&k=cycling&l=52241&r=100&v=json&api_key={api-key}";
var scriptBlock = document.createElement('script');
scriptBlock.src = url;
scriptBlock.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(scriptBlock);
From my understanding, writing the url in this way is supposed to generate the returned search json object inside a call to dataFunction, e.g.:
dataFunction(jsonSearchResultObject)
But your API only returns the jsonSearchResultObject, with no callback. Is there any way to get the desired functionality from your API?
Thanks.
Dave
Message edited by dave 15 years ago
active Admin – 15 years ago
try using "cb=dataFunction" instead of "callbackMethod=dataFunction". Let me know how you go.
dave – 15 years ago
Perfect - thanks!
Dave