Skip to content

Instantly share code, notes, and snippets.

@andylind
Created May 11, 2011 01:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andylind/965715 to your computer and use it in GitHub Desktop.
Save andylind/965715 to your computer and use it in GitHub Desktop.
jQuery cross domain ajax example
<!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