Created
August 14, 2009 03:52
-
-
Save pvalencia/167635 to your computer and use it in GitHub Desktop.
async but not ajax cross-site
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></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