Jquery 带有Twitter oEmbed的JSON请求
我正在尝试使用Twitter API在我的站点上嵌入一条推文,并使用jQuery进行JSON调用。Twitter参考页面对于如何实际执行Get请求非常模糊: 我缺少一些基本的东西。为什么:Jquery 带有Twitter oEmbed的JSON请求,jquery,json,twitter,Jquery,Json,Twitter,我正在尝试使用Twitter API在我的站点上嵌入一条推文,并使用jQuery进行JSON调用。Twitter参考页面对于如何实际执行Get请求非常模糊: 我缺少一些基本的东西。为什么: $(document).ready(function() { $.getJSON('https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FInterior%2Fstatus%2F507185938620219395',
$(document).ready(function() {
$.getJSON('https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FInterior%2Fstatus%2F507185938620219395',
function(data) { alert("hi");}
);
});
不会导致我的警报 这个URL是什么https://publish.twitter.com/oembed。文件上写着
https://api.twitter.com/1.1/statuses/update.json?status
请参见本页底部的示例。如果你将我的URL复制并粘贴到你的浏览器中,你会下载一个JSON文件。你能试试这个吗<代码>var href=https://twitter.com/intent/tweet?text=“+encodeURIComponent('I check out here@XXX')+”&url='+encodeURIComponent(\websiteURL\);jQuery(“\your element\”).attr(“href”,href)代码>点击这个锚定标签,会弹出一个窗口,你可以分享它