She*_*Pro 0 twitter jquery facebook getjson
任何人都可以告诉我为什么这个jQuery函数不起作用.它没有alert
.
$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?',
{
screen_name: 'samajshekhar',
count: '5',
},
function (data) {
alert('hello world from twitter');
});
Run Code Online (Sandbox Code Playgroud)
在fiddler中,我可以看到已经返回了预期的JSON.
但是,当使用jQuery文档中的示例代码调用flicker的api时,它会alert
按预期方式提供
$.getJSON('http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?',
{
tags: 'cat',
tagmode: 'any',
format: 'json'
},
function(data) {
alert('hello world from flicker');
});
Run Code Online (Sandbox Code Playgroud)
我甚至试过Facebook的图形API仍然没有 alert
在示例代码中,我尝试使用getJSON调用facebook,twitter,flicker,只提出了闪烁的调用alert
.
您需要将一个回调参数附加到url,以便它成为一个jsonp调用.
http://api.twitter.com/1/statuses/user_timeline.json?callback=?
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3206 次 |
最近记录: |