我試圖從Web APIAJAX網絡API調用
http://www.streetdirectory.com/api/?mode=search&act=all&profile=sd_default&q=640724&limit=1&show_additional=0&output=json
使用Ajax,我遇到的問題,由此我得到這個錯誤得到json
數據。
var addresses = new Array();
getAddress();
var myURL = "http://www.streetdirectory.com/api/?mode=search&act=all&profile=sd_default&q=640724&limit=1&show_additional=0&output=json";
function getAddress() { //get addresses from streetdirectory web API
$.ajax({
type: "GET",
url: myURL,
dataType: "json",
success: function(response){
addresses = response;
alert(response);
},
error: function(e) {
alert('Error: '+e);
console.log('Error: ' +e);
}
});
}
這似乎是因爲我直接訪問html。我已經把它移到我的本地主機上。但它仍然有錯誤,沒有任何現在...描述
我的函數調用轉移到我的函數定義後,我現在收到此錯誤後。