Skip to content

Instantly share code, notes, and snippets.

@kjam
Created July 21, 2011 15:09
Show Gist options
  • Save kjam/1097401 to your computer and use it in GitHub Desktop.
Save kjam/1097401 to your computer and use it in GitHub Desktop.
Twitter Search
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.getJSON('http://search.twitter.com/search.json?q=earthquake&lang=en&callback=?', function(data) {
var data = data.results;
var html = "<ul>";
for(var i=0; i<data.length; i++) {
html += "<li><a href='http://twitter.com/" + data[i].from_user + "'>@"
+ data[i].from_user + "</a>: " + data[i].text + "</li>";
}
html += "</ul>"
$('.content').html(html);
});
});
</script>
</head>
<body>
<h2>Twitter</h2>
<div class="content">
</div>
</body>
</html>
@elserafi
Copy link

The Twitter REST API v1 is no longer active and should migrate to API v1.1. That's why the code mentioned above doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment