问题
I was following this tutorial on how to parse twitter search api requests with jquery.
http://webhole.net/2009/11/28/how-to-read-json-with-javascript/
The code in the post uses a search box for the user to enter the search term and what I simply wanted to do was remove the search part since I know the #tag that I want to search for:
<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 am getting in Firebug is NetworkError: 405 Method Not Allowed
and I was just wondering if anyone could shine some light as to why I've broken this code.
Thanks,
回答1:
ah, the problem was that I was missing the callback
parameter so the options
variable should read as follows:
var options='&result_type=recent&count=5&callback=?';
来源:https://stackoverflow.com/questions/7430492/twitter-search-api-networkerror-405-method-not-allowed