Skip to content

Instantly share code, notes, and snippets.

@rutger1140
Created June 14, 2012 13:16
Show Gist options
  • Save rutger1140/2930242 to your computer and use it in GitHub Desktop.
Save rutger1140/2930242 to your computer and use it in GitHub Desktop.
Simple Twitter search with jQuery
/* Simple Twitter search */
var hashtag = "#ek2012";
var urlhash = encodeURIComponent(hashtag);
var numPosts = 1;
var target = $("#tweetwrap");
var ajaxurl = "http://search.twitter.com/search.json?callback=?&q="+urlhash+ "&rpp="+numPosts;
$.getJSON(
ajaxurl,
function (data){
$.each(data.results, function(i,post){
target.append(
'<q>'+post.text + '</q>'
);
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment