Public api get number of shares JSON problem

eldiabel Jul 25, 2012 03:29AM EDT

Quote by Paul:
***To pull the share count for a specific URL you can call this URL:

http://api-public.addthis.com/url/shares.json?url=http%3A%2F%2Flocalhost%2F~paul%2Fscratchpad.html

Replace http%3A%2F%2Flocalhost%2F~paul%2Fscratchpad.html with the encoded URL you'd like the count for. This will return the number of counts as a JSON variable***

When I want to call this url by javascript and get JSON variable, console reports javascript origin policy error. This is usually solved by JSONP (wrapping it in callback), but how to do that for public api ? I didn't find anywhere exact JSONP for public api, only for services and analytics, but this way it doesn't work.
Help please, thank you.

Up -1 Rated Down
Paul (AddThis Happiness Specialist) Jul 27, 2012 10:29AM EDT
You can add a JSONP function by adding the callback parameter to the URL, like this:

http://api-public.addthis.com/url/shares.json?url=http%3A%2F%2Flocalhost%2F~paul%2Fscratchpad.html&callback=yourcallbackfunction

This question is closed to new answers.

Still need help?


General Topics

 

Developers