JQuery.getJSON not working for twitter

Can someone tell me why this jQuery function is not working. He does not raise alert.

$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?',
  {
      screen_name: 'samajshekhar',
      count: '5',
  },
 function (data) {
      alert('hello world from twitter');
  });   

In fiddler, I see that the expected JSON has been returned.

However, when calling flicker api using the sample code in the jQuery documentation, it gives alertas expected

$.getJSON('http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?',
  {
    tags: 'cat',
    tagmode: 'any',
    format: 'json'
  },
  function(data) {
   alert('hello world from flicker');   
  });

Here is a sample JS Bin code

I tried even with the facebook api not yet alert

As a sample code , I tried facebook getJSON calls, twitter, flicker and just a flick call alert.

0
source share
3 answers

URL-, jsonp.

http://api.twitter.com/1/statuses/user_timeline.json?callback=?
+9

, API Flickr JSONP, API Twitter JSON. Twitter, JSON , , ; , JSONP .

, '? callback =?' URL- API Twitter JSONP.

+3

JSONP URL

$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?jsoncallback=?',
+2

All Articles