我想知道我的代码有什么问题会产生以下错误消息: NetworkError: 403 Forbidden - http://www.googleapis.com/fusiontables/v1/query?
我相信我正确地引用了新的 SQL V1 API,并且我引用的表是允许导出数据的基表。
代码片段
function getEcoliData(beachID) {
//local namespace
var rows = [];
var items = [];
var queryURL = "http://www.googleapis.com/fusiontables/v1/query?sql=";
var queryTail = '&jsonCallback=?';
var whereClause = "WHERE 'Beach_ID' = " + beachID;
var query = "SELECT 'Sample_Date', 'Average_E.coli_Density','Recreational_Water_Quality_Guideline' FROM 1-ZORhnuDELDxO1FsmzJ60K3JzWOYOKvsHibrQeo " + whereClause + " ORDER BY 'Sample_Date' DESC";
var queryText = encodeURI(query);
infoWindow = new google.maps.InfoWindow();
$.ajax({
type: "GET",
url: queryURL + queryText + queryTail,
cache: false,
dataType: 'jsonp',
jsonCallback: 'jsonCallback',
success: function (data) {
rows = data.tables.rows;
for (var i = 0; i < rows.length; i++) {
items.push(rows[i]);
}
return items;
},
error: function () {
alert("Data is not available for this location at the present time, please check back at a later time. Thank you.");
}
});
}
欢迎任何建议。提前致谢。迈克尔