Home  >  Article  >  Web Front-end  >  Implementation code for inserting multiple pieces of data into a modal box using jQuery_jquery

Implementation code for inserting multiple pieces of data into a modal box using jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 16:34:341355browse

Copy code The code is as follows:

//Bootstrap modal box (partial)

Copy code The code is as follows:

/**
* View data details
* @黑eyed poet
*/
function orderDetail(order_no)
{
//1. Clear the modal box data first
$('#orderDetail').find('tr').first().nextAll().remove();

//2. External insertion
var order_no = order_no;

$.post(base_url '?d=admin&c=orders&m=ajax_order_detail', {order_no:order_no}, function(data){

​ //The format of data is as follows: [{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("" n['organize_name'] ":" n['cate_name'] " -- " n['course_name'] "< td>" n['old_price'] "" n['sale_price'] "");
});
});
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn