Skip to content

Instantly share code, notes, and snippets.

@pvalencia
Created August 14, 2009 03:52
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 pvalencia/167635 to your computer and use it in GitHub Desktop.
Save pvalencia/167635 to your computer and use it in GitHub Desktop.
async but not ajax cross-site
<html>
<head></head>
<body>
<ul id="tweets">
</ul>
<a href="#">reload tweets</a>
<script src="jquery-1.3.2.min.js"></script>
<script>
function updateTwitter(tweets) {
var uls = '';
$(tweets).each(function(i, el) {
uls += '<li>' + el.text + '</li>';
});
$('#tweets').html(uls);
}
$('a').click(function() {
$('body').append($('<script src="http://twitter.com/statuses/user_timeline/pvalencia.json?callback=updateTwitter&count=3" />'));
});
</script>
<script src="http://twitter.com/statuses/user_timeline/pvalencia.json?callback=updateTwitter&count=3"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment