2014-02-11 33 views
0

我想从Google FusionTable(FT)的一列中检索所有值(针对该事项的郊区名称)。 我可以使用jQuery的Ajax调用访问列本身:从Google Fusion表格中回收列值

$.ajax({ 
    url: 'https://www.googleapis.com/fusiontables/v1/tables/'+ tableID +'/columns/Suburb?key=' + key, 
    success: function(data) { 
     console.log(data); 
     suburbs_list = data; 
    }, 
    error: function(data) { 
     console.error(['error', data]); 
    } 
}); 

返回

suburbs_list 
Object {kind: "fusiontables#column", columnId: 0, name: "Suburb", type: "LOCATION"} 

,但我无法找到访问该列中的值的方式。有没有办法,或者我必须遍历每一行并获得每行的第一列值?

我已经通过文档,但没有任何关于此的任何文字。 https://developers.google.com/fusiontables/docs/v1/reference/column

感谢您的任何意见

回答

0

您需要使用查询来读取行。您可以指定要在SELECT子句中获得哪些列。有关详细信息,请参阅此帮助页面:https://developers.google.com/fusiontables/docs/v1/using#WorkingRows

+0

解析这是实际的代码: 'VAR queryURLHead =的 'https://www.googleapis.com/fusiontables/v1/query SQL =';'' 变种queryURLTail = '&jsonCallback =';' 'VAR查询= “SELECT市郊FROM” + TABLEID + “LIMIT 750”;' '变种queryURL =是encodeURI(queryURLHead +查询+ queryURLTail + '&键=' +键);' (函数dataHandler(d)){' 'console.log(d.rows [0]);' 'console.log('); d.rows [0]);'' }' – datafunk

+0

对不起 - 没有按”无论我做什么,我都无法在代码格式化中正确评论:\ – datafunk