<!DOCTYPE html>
<html>
<head>
<title>TODO</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="jquery.js"></script>
<script src="sample.js"></script>
</head>
<body onload="sample()">
<p id="memo"></p>
</body>
</html>
var point=new Array();
function sample() {
var query = "SELECT * FROM " +
'1WoSQFZKqnQV4S-HWwjGLTdZGqNdP72rl_N_OWfHY';
var encodedQuery = encodeURIComponent(query);
var url = ['https://www.googleapis.com/fusiontables/v1/query'];
url.push('?sql=' + encodedQuery);
url.push('&key=AIzaSyAH0WCAXRIdHdbI-6bnMSN4kVDDZZmGyqY');
url.push('&callback=?');
$.ajax({
url: url.join(''),
dataType: 'jsonp',
success: function (data) {
var rows = data['rows'];
sx = 0;
for (var i in rows) {
sx = sx + 1;
point[sx]=rows[i][3];
}
number=sx;
paint();
}
});
}
function paint(){
str1="<table class=\"mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp\">";
str2="<th class=\"mdl-data-table__cell--non-numeric\">";
str3="<td class=\"mdl-data-table__cell--non-numeric\">";
str=str1;
str=str+"<thead>";
str=str+"<tr>";
str=str+str2+"猫</th>";
str=str+"<th>犬</th>";
str=str+"<th>水</th>";
str=str+"</tr>"
str=str+"</thead>";
str=str+"<tbody>";
for(sx=1;sx<number+1;sx++){
str=str+"<tr>";
str=str+str3+"Acrylic (Transparent)</td>";
str=str+"<td>"+point[sx]+"</td>";
str=str+"<td>$2.90</td>";
str=str+"</tr>";
}
str=str+"</table>";
$("#memo").html(str);
}
最終更新:2016年08月17日 05:29