하위 게시판의 첫 번째 permalink로 내 div를 추가하고 싶습니다. 나는 jQuery의 문서, Smashing Magazine의 기사 및 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 : 당신은 올바른 생각을 가지고 있지만, 대부분의 브라우저는 당신이 때문에 api.reddit.com
에 액세스 할 수 없습니다 http://jsfiddle.net/AdVS3/2/
중복 된 http://stackoverflow.com/questions/8191105/how-to-extract-url-data-from-reddit-api-using-json – Niko
'api.reddit.com/r/aww/.json '은 적절한 URL이 아니라 URL 경로입니다. – Gumbo