0
我試圖獲取數據,但以下腳本不起作用。你能幫我弄明白嗎?使用anyorigin在JavaScript中獲取JSON
function initialize() {
$.getJSON('http://anyorigin.com/get?url=http%3A//www.wawhost.com/appProject/fetchmarker.php&callback=?', function (data) {
localStorage.jsontext = data.contents;
});
}
localStorage.jsontext = localStorage.jsontext.replace('(', '{"temp":');
localStorage.jsontext = localStorage.jsontext.replace(')', '}');
obj = JSON.parse(localStorage.jsontext);
for(var i=0;i<=5;i++) {
document.write('<img src="' + obj.temp[i].image + '" />');
document.write(obj.temp[i].id);
document.write(obj.temp[i].location);
document.write('<br>');
}
謝謝!
你是最好的!非常感謝你! – alesko007