代碼如下:
//bootstrap模態(tài)框(局部)
<div class=modal fade id=orderdetail>
<div class=modal-dialog>
<div class=modal-content>
<div class=modal-header>
</div>
<div class=modal-body>
<table class=table>
<tr>
<td>名 稱</td>
<td>原 價</td>
</tr>
</table>
</div>
<div class=modal-footer>
</div>
</div>
</div>
代碼如下:
/**
* 查看數(shù)據(jù)詳情
* @黑眼詩人 <www.chenwei.ws>
*/
function orderdetail(order_no)
{
//1.先清空模態(tài)框數(shù)據(jù)
$('#orderdetail').find('tr').first().nextall().remove();
//2.外部插入
var order_no = order_no;
$.post(base_url + '?d=admin&c=orders&m=ajax_order_detail', {order_no:order_no}, function(data){
//數(shù)據(jù)的格式如: [{no:123,old:abc},{no:234,old:def},{no:345,old:ghi}]
var obj = eval('(' + data + ')');
$.each(obj, function(i, n){
var tr = $('#orderdetail').find('tr').last();
tr.after(<tr><td>+ n['organize_name'] + : + n['cate_name'] + -- + n['course_name'] +</td><td>+ n['old_price'] +</td><td> + n['sale_price'] + </td></tr>);
});
});
}