JSFiddle - React, Tailwind, and code Playground
by phgrey
HTML
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<div id="echoer"></div>
JavaScript
google.load('visualization', '1',
{
callback:function(){
//формирование запроса
var queryText = 'SELECT id, name FROM 596524;';
//url запроса
var reqUri = 'http://www.google.com/fusiontables/gvizdata?tq=' + encodeURIComponent(queryText);
//создаем объект visualization
var query = new google.visualization.Query(reqUri);
//посылаем запрос и указываем функцию - обработчик ответа
query.send(displayData);
}
});
function displayData(response) {
//более детальная информация об объекте response доступна здесь
//http://code.google.com/apis/visualization/documentation/reference.html#QueryResponse
numRows = response.getDataTable().getNumberOfRows();
numCols = response.getDataTable().getNumberOfColumns();
//concatenate the results into a string, you can build a table here
fusiontabledata = "<b>";
for(i = 0; i < numCols; i++) {
fusiontabledata += response.getDataTable().getColumnLabel(i) + ",";
}
fusiontabledata += "</b><br />";
for(i = 0; i < numRows; i++) {
for(j = 0; j < numCols; j++) {
fusiontabledata += response.getDataTable().getValue(i, j) + ", ";
}
fusiontabledata += "<br />";
}
//display the results on the page
document.getElementById('echoer').innerHTML = fusiontabledata;
}