Question about the Callback parameter
diligent
Registered Users Posts: 3 Beginner grinner
For the API 1.2.2, what does the Callback parameter do?
Does it exist to support a specific style of communication? (for example AJAX?)
Are there any specifications and/or links to better explain this parameter?
Thanks,
Does it exist to support a specific style of communication? (for example AJAX?)
Are there any specifications and/or links to better explain this parameter?
Thanks,
0
Comments
The callback parameter was specifically implemented for JSONP. Which allows ajax calls to be made without the headaches of cross domain issues.
To do so, you would embed a script element on your webpage with the url of a specific SmugMug api call...kinda like this...
<*script* src="http://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.albums.get&Callback=myCallback">
The JSON response is then wrapped within the call to myCallback, like this...
myCallback({"stat": "ok", "method": "smugmug.albums.get", "Albums": []});
This assumes that myCallback is defined locally.
That's pretty much it, googling JSONP should fill in any other blanks.
Cheers,
David
SmugMug API Developer
My Photos
That fills in the gap nicely. Is there any way to update the public api documentation with this information?
I suppose for now maybe I can leave a comment on the doc page...