Skip to content

Instantly share code, notes, and snippets.

@visualzhou
Created August 14, 2012 09:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save visualzhou/3347849 to your computer and use it in GitHub Desktop.
Save visualzhou/3347849 to your computer and use it in GitHub Desktop.
Douban Cross-domain Ajax
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="images">
</div>
<script>
function process_data(data) {
a = []
$.each(data.entry, function(i,item){
a.push(item.title.$t);
});
alert("length:"+a.length)
alert(a);
}
jQuery.getJSON("http://api.douban.com/book/subjects?callback=?",
{
q: "computer",
alt: "xd",
"start-index": 1,
"max-results": 5
},
process_data);</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment