参考这个链接,当我将代码添加到我的示例地图以计算它工作的标记时。代码是,
var tableid="xxxxxxxxxxxxxx";
var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=';
var queryUrlTail = '&jsonCallback=?';
var query = "SELECT COUNT() FROM tableid"
var queryurl = encodeURI(queryUrlHead + query + queryUrlTail);
var getCount = $.get(queryurl,
function(data){
try{
$('#count').html((data.table.rows[0][0]));
}
catch(err){
$('#count').html('0');
}
},
"jsonp");
但是当我将我的 api 更改为 v1 时
var tableid="xxxxxxxxxxxxxx";
var apiKey = "XXXXXXXX";
var queryUrlHead = 'https://www.googleapis.com/fusiontables/v1/query?sql=';
var queryUrlTail = '&key=' + apiKey + '&callback=?';
var query = "SELECT COUNT() FROM tableid"
var queryurl = encodeURI(queryUrlHead + query + queryUrlTail);
var getCount = $.get(queryurl,
function(data){
try{
$('#count').html((data.table.rows[0][0]));
}
catch(err){
$('#count').html('0');
}
},
"jsonp");