任何人都可以告诉我为什么这个jQuery功能不起作用。它不提供alert
。jQuery.getJSON不适用于twitter
$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?',
{
screen_name: 'samajshekhar',
count: '5',
},
function (data) {
alert('hello world from twitter');
});
在小提琴手我可以看到,预期的JSON已被返回。
但是呼叫使用在jQuery的文档的示例代码闪烁的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');
});
我甚至与Facebook的图形API仍然没有alert
在sample code我试图getJSON调用Facebook,Twitter,闪烁,只有闪烁的电话alert
被引发。
试过没有运气! – 2011-03-03 16:58:00
它应该工作。这对我来说很好,例如:api.twitter.com/1/statuses/user_timeline.json?screen_name=marcusf&callback=function_i_want_to_run。给我正确的jsonp响应。 – 2011-03-03 17:01:25
是的,它工作..thanx ..它没有与jsoncallback工作,但与回调..任何解释.. ia新手到jQuery^_^ – 2011-03-03 17:08:13