0
展示我真的需要閱讀該URL的JSON數據幫助:JSON值不是的getJSON功能
http://www.cloudspokes.com/members/ferbie12/past_challenges.json
我想使用--disable-web-security
谷歌瀏覽器來解決跨域問題。 這是我編寫的用於讀取JSON上的簡單值的代碼。
$.getJSON("www.cloudspokes.com/members/ferbie12/past_challenges.json",function(data) {
$.each(data, function(){
var test = data.attributes.type;
$('p#success').append(test);
});
});
它不會在瀏覽器上顯示任何內容。 真的很感謝幫助。
更新: 我也試過使用這些代碼。仍然沒有結果。
$.ajax({
type: "POST",
url: "www.cloudspokes.com/members/ferbie12/past_challenges.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
$.each(data, function(){
var test = data.attributes.type;
$('p#success').append(test);
});
itemAddCallback(data);
},
error: function (xhr, textStatus, errorThrown) {
$("#success").html(xhr.responseText);
}
});
您好感謝回答......找到了解決辦法它似乎跨域的問題仍然沒有解決與「 - 禁用網絡安全」... 也你的答案幫助我......謝謝:D – 2012-08-05 20:53:56