jquery inserts multiple data into the modal box sample code _jquery

Source: Internet
Author: User
//bootstrap modal box (partial) <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> name </td> <td> original Price </td> </tr> </table> </div> <div class= "Modal-footer" > </div> </div> </div>

/** * View data Details * @ Black-eyed poet <www.chenwei.ws>/function OrderDetail (order_no) {//1. Clear the Modal box first

  Data $ (' #orderDetail '). Find (' tr '). Nextall ().

2. Externally inserted var order_no = order_no; $.post (Base_url + '? D=admin&c=orders&m=ajax_order_detail ', {order_no:order_no}, function (data) {//data format such as: [{

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> ");
});
}); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.