此代码:
$(document).ready(function() {
$("a#hm").on('click', function(){
$.ajax({
url: 'getTroskovnik.php', // make this url point to the data file
dataType: 'json',
//data:{id_akt:ajdi},
async: false,
type: 'POST',
success:function(json){
console.log(json);
var data = new google.visualization.DataTable(json);
// Create and draw the visualization.
visualization = new google.visualization.Table(document.getElementById('tpltroskovnik'));
visualization.draw(data, {'allowHtml': true, 'width': '100%'});
},
error:function(json) {
console.log(json);
}
});
});
});
当我把它放在我的网页上时,对我不起作用,但是当我在浏览器控制台中编写它时它会起作用。可能是什么问题?