Skip to content

Instantly share code, notes, and snippets.

@endoze
Created September 25, 2012 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endoze/3779815 to your computer and use it in GitHub Desktop.
Save endoze/3779815 to your computer and use it in GitHub Desktop.
Twitter Ajax Query
$.ajax({
dataType: 'jsonp',
jsonp: 'callback',
url: 'http://search.twitter.com/search.json?q=fwgangnamstyle',
success: function(obj) {
for (var i = 0; i <= obj['results'].length - 1; ++i) {
var user = obj['results'][i]['from_user'];
var tweet_text = obj['results'][i]['text'];
var html = "<li><a href=https://twitter.com/" + user + ">@" + user + "</a> said " + tweet_text + "</li>";
console.log(obj['results'][i]);
$("#tweet-feed ul").append(html);
};
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment