获取LinkedIn共享计数JSONP [英] Get LinkedIn share count JSONP

查看:110
本文介绍了获取LinkedIn共享计数JSONP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用LinkedIn API,我想获取URL的共享计数.

Using the LinkedIn API, I want to get the share count for an URL.

https://www.linkedin.com/countserv/count/share?url=http://www.linkedin.com&format=json

但是由于同源策略,这给了我一个错误. 我想使用JSONP来获取数据,但是我被卡在那里.

But this gives me an error because of Same-Origin Policy. I want to use JSONP to then get the data, but I am stuck there.

$.getJSON("https://www.linkedin.com/countserv/count/share?url=https://www.linkedin.com&format=jsonp&callback=myCallback", function(data) {
    elem.find(".count").html(data.count);
});

我仍然收到同源策略"错误,并且data.count中没有数据. 谁能帮我吗?谢谢!

I still get the Same-Origin Policy error and no data from data.count. Can anyone help me out? Thanks!

推荐答案

感谢大家的回答,但是我已经自己解决了.

Thanks everyone for your answers, but I solved it already myself.

这对我有用:

$.getJSON("http://www.linkedin.com/countserv/count/share?url=https://www.linkedin.com&format=jsonp&callback=?", function(data) {
        elem.find(".count").html(data.count);
});

这篇关于获取LinkedIn共享计数JSONP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆