我想追加我的div与subreddit第一永久链接。我试过了jQuery的文档,Smashing杂志的文章和reddit的github,但没有任何影响。请帮我理解如何做到这一点。getJSON + reddit api - 如何咬它?
的Jquery:
$(document).ready(function(){
$.getJSON("api.reddit.com/r/aww/.json", function(json){
$(".slodziaki").append("<p>Permalink</p>"+ json.data.children.data[0].permalink)'
});
});
HTML:
<html>
<head>
<meta charset="utf-8">
<title>Słodziaki.</title>
<script>
</script>
</head>
<body>
<div class="slodziaki">
Reddit api test.
</div>
</body>
</html>
的jsfiddle:http://jsfiddle.net/AdVS3/2/
重复http://stackoverflow.com/questions/8191105/how-to-extract-url-data-from-reddit-api-using-json – Niko 2012-03-10 17:46:51
'api.reddit.com/r/aww/.json '不是一个合适的URL,而只是一个URL路径。 – Gumbo 2012-03-11 10:16:05