• Register

ACTIVE Network API Forums

API Forum

RSS Feed

callbackMethod for JSON data?

    • dave
    • Topic created 16 years ago

    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 16 years ago

  1. active Admin16 years ago

    try using "cb=dataFunction" instead of "callbackMethod=dataFunction". Let me know how you go.

  2. dave16 years ago

    Perfect - thanks!

    Dave

[ Page 1 of 1 ]