Created
May 11, 2011 01:04
-
-
Save andylind/965715 to your computer and use it in GitHub Desktop.
jQuery cross domain ajax example
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
<title>jQuery cross domain ajax example</title> | |
<script type="text/javascript" | |
src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"> | |
</script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$.getJSON('http://api.twitter.com/1/trends/1.json?callback=?', | |
function(json){ | |
$('#mydiv').text(json[0].trends[0].name); | |
} | |
); | |
}); | |
</script> | |
</head> | |
<body> | |
<h3>Top Twitter Trend:</h3> | |
<div id="mydiv">Loading...</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment