【发布时间】:2019-08-09 18:06:15
【问题描述】:
我有一个表格,我想将我从 ajax 调用中获得的数据放入列而不是行中,这里是表格正文代码
<tbody id="tableData-marketMonth">
<tr>
<th>Leads</th>
</tr>
<tr>
<th>Full Year Cost</th>
</tr>
<tr>
<th>{{date('F')}} Share of Cost</th>
</tr>
<tr>
<th>Cost per Lead</th>
</tr>
</tbody>
这是将数据放入表中的 JavaScript 代码
//Monthly Marketing Cost Report
$.get('/dashboard/costs', function(data){
$.each(data,function(i,value){
var tr =$("<tr/>");
tr.append($("<th/>",{
text : value.olxTotal
})).append($("<th/>",{
text : value.budget_total_year
})).append($("<th/>",{
text : value.budget_total_month
})).append($("<th/>",{
text : value.budget_per_lead
}))
$('#tableData-marketMonth').append(tr);
})
})
非常感谢
【问题讨论】:
-
谢谢你的回答我试过了,但我没有工作
标签: javascript jquery mysql laravel