我想使用jquery生成这个数据的表格。怎么???
我从数据库查询获得的这一组数据
Array
(
[0] => stdClass Object
( [id] => 61
[name] => Habib
[timeview] => 3.56
[monthnew] => july
)
[1] => stdClass Object
( [id] => 61
[name] => Habib
[timeview] => 2.75
[monthnew] => august
)
[2] => stdClass Object
( [id] => 61
[name] => Habib
[timeview] => 4.81
[monthnew] => september
)
)
这是ajax方法.....
ajax.done(function(data) {
// What code should be here.....
}
答案 0 :(得分:0)
你想要这样的东西:$ table将是你要追加的表。如果您想了解更多详情,请告诉我们
$table = jQuery('#table');
$.ajax({
type: "POST",
url: "your-script.php",
success: function (data) {
for(var i = 0; i < data.length; i ++) {
$table.append("<tr>" + data[i].text + "</tr>");
}
}
});