Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 带有Twitter oEmbed的JSON请求_Jquery_Json_Twitter - Fatal编程技术网

Jquery 带有Twitter oEmbed的JSON请求

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',

我正在尝试使用Twitter API在我的站点上嵌入一条推文,并使用jQuery进行JSON调用。Twitter参考页面对于如何实际执行Get请求非常模糊:

我缺少一些基本的东西。为什么:

$(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)点击这个锚定标签,会弹出一个窗口,你可以分享它