If you have any question left, please drop a note with the discussion link of this page.
Callback Handler
From Wiki.zanox.com
(Redirected from Dynamic Script Tag)
zanox Web Services support of the Dynamic Script Tag Pattern. Here you can learn what it is, how to do cross domain requests to the zanox Web Services.
Usage of 'callback=function' with static script tag
Example: A product search against the product feeds of the programme with the ID 12345.
<script src="http://api.zanox.com/json/2009-07-01/products?connectid=abc..&programs=12345&q=searchString&callback=myCallbackHandler"> </script> <script> function myCallbackHandler(jsonData){ //do something with jsonData, which is the result of the API query } </script>
Usage of 'callback=function' with dynamic script tag
<script> function callAPI(url){ var script = document.createElement('script'); script.src = url; // sets the scripts source to the Rest/JSON API query script.type = "text/javascript"; document.getElementsByTagName('head')[0].appendChild(script); // the browser performs a request to the zanox API. // as soon as the script tags source is loaded, the callback function is called } function myCallbackHandler(jsonData){ //do something with jsonData, which is the result of the API query } } var url = 'http://api.zanox.com/json/2009-07-01/products?connectid=abc&programs=12345&q=searchString&callback=myCallbackHandler'; callAPI(url); </script>