嗨誰能幫我裝JSON爲jQuery的我只能似乎得到它在這個structor麻煩與jQuery加載JSON
{ 「名」工作:「Zemi全部」, 「SMPX」: 「2564」, 「scuser」: 「zajihi」, 「scfollowers」: 「女」 }
這是該格式的網頁我有 - http://newmusicproducer.com/filterable/indexj.php
我下面的代碼是:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#driver").click(function(event){
$.getJSON('test.json', function(data) {
$.each(data.results,function(){
$('#stage').html('<p> Name: ' + data.name + '</p>');
$('#stage').append('<p> Smpx : ' + data.smpx+ '</p>');
$('#stage').append('<p> Scuser: ' + data.scuser+ '</p>');
$('#stage').append('<p> Scfollowers: ' + data.scfollowers+ '</p>');
});
});
});
});
</script>
</head>
<body>
<p>Click on the button to load results:</p>
<div id="stage" style="background-color:blue;">
Display area.
</div>
<input type="button" id="driver" value="Load Data" />
</body>
你什麼錯誤?服務器上的文件是?你真的加載'test.json'還是你想要訪問上面的網站? – 2012-04-21 16:55:52
不是鏈接是我正在嘗試加載其相同網站的格式。沒有錯誤只是沒有得到任何數據。 – 2012-04-21 17:46:26