Twitter Search API - NetworkError: 405 Method not allowed

I followed this guide on how to parse twi queries to find api using jquery.

http://webhole.net/2009/11/28/how-to-read-json-with-javascript/

The code in the message uses the search box for the user to enter a search query, and what I just wanted to do was delete the search part, since I know the #tag that I want to find:

<div id="results"></div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ var url='http://search.twitter.com/search.json?q='; var query='%23HASHTAGOFMYCHOOSING'; var options='&result_type=recent&count=5'; $.getJSON(url+query+options,function(json){ $.each(json.results,function(i,tweet){ $("#results").append('<p><img src="'+tweet.profile_image_url+'" width="48" height="48" />'+tweet.text+'</p>'); }); }); }); 

The error I get in Firebug is NetworkError: 405 Method Not Allowed , and I'm just wondering if anyone can illuminate some light, why I broke this code.

Thanks,

+1
source share
1 answer

ah, the problem was that I was missing the callback parameter, so the options variable should look like this:

 var options='&result_type=recent&count=5&callback=?'; 
+1
source

Source: https://habr.com/ru/post/913620/


All Articles