0

I am trying to ger ajax response from below web url of twitter to but it returns always error.No way I am able to get it work.

URL is http://search.twitter.com/search.json?q=&ands=google?callback=?

I have added a callback at end.I suspect it's cross domain request so I have tried with crossDomain:true also.

So code is as below:

 $(document).ready(function () { var weblink = 'http://search.twitter.com/search.json?q=&ands=google?callback=?'; $.ajax({ url: weblink, dataType: 'jsonp', success: function (data) { alert('ok'); // this statement doesn't show up }, error: function (msg) { // failed request; give feedback to user alert('error occured' + msg); console.log(msg); } }); $.getJSON("http://search.twitter.com/search.json?q=&ands=google?callback=?", function (result) { alert('success'); }); }); 

Here is the screenshot when I debug on F12.Console Error

Does anyone have any idea what's wrong happened.

2
  • is it about the version? stackoverflow.com/questions/17114204/… Commented Apr 11, 2015 at 14:26
  • If you had just pasted the URL you're using into the browser, you would have seen The Twitter REST API v1 is no longer active. Please migrate to API v1.1 Commented Apr 11, 2015 at 14:27

1 Answer 1

1

I guess it is about the version, as it says The Twitter REST API v1 is no longer active. Please migrate to API v1.1 when you view this in your browser: http://search.twitter.com/search.json?q=&ands=google?callback=?

Instead, you should have the following:

https://api.twitter.com/1.1/search/tweets.json?q=mykeyword 

You can check this discussion: How to get twitter search results as json with simple browser entry since Twitter v1.1?

Sign up to request clarification or add additional context in comments.

Comments