Created
January 28, 2013 11:36
-
-
Save ahappyforest/4654821 to your computer and use it in GitHub Desktop.
This file contains hidden or 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><title>Hello World</title></head> | |
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'></script> | |
<body> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$.ajax({ | |
url : "http://www.xkcd.com/info.0.json", | |
ansy : true, | |
success : function(connent){ | |
alert(connent); | |
var obj = eval('('+connent+')'); | |
$("body").html(obj.img); | |
}, | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
貌似ajax的success方法这么使用的:(你试试啊),成功了告诉我啊:)
<title>Hello World</title> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'></script> <script type="text/javascript"> $(document).ready(function(){ $.ajax({ type:"GET", url : "http://www.xkcd.com/info.0.json", ansy : true }).success(function(connent){ alert(connent); var obj = eval('('+connent+')'); $("body").html(obj.img); }); }); </script>