Created
May 10, 2012 06:29
-
-
Save Jacqopb/2651448 to your computer and use it in GitHub Desktop.
AJAX Twitter client built with jQuery
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 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?callback=?&q='; | |
var query; | |
$('#queryButton').click(function(){ | |
$("#twitterResults").html(''); | |
query=$("#queryString").val(); | |
$.getJSON(url+query,function(jsonTwitter){ | |
$.each(jsonTwitter.results,function(i,tweet){ | |
$("#twitterResults").append('<p>'+ tweet.text +'</p>'); | |
}); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<input type="text" id="queryString"> | |
<input type="button" id="queryButton" value="Search"> | |
<div id="twitterResults"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First example of Twitter client with jQuery and Ajax