Created
July 21, 2011 15:09
-
-
Save kjam/1097401 to your computer and use it in GitHub Desktop.
Twitter Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
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
"; for(var i=0; i@" + data[i].from_user + ": " + data[i].text + ""; } html += "
" $('.content').html(html); }); }); </script>Twitter