[jQ]使用jQuery將多條資料插入模態框的方法

來源:互聯網
上載者:User

標籤:style   blog   color   io   os   使用   ar   資料   div   

------------------------------------------------------------------------------------------------------

//Bootstrap模態框(局部)<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>

 [email protected]黑眼詩人 <www.chenwei.ws>------------------------------------

/**
* 查看資料詳情
* @黑眼詩人 <www.chenwei.ws>
*/
function
orderDetail(order_no){ //1.先清空模態框資料 $(‘#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){
     //資料的格式如: [{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>"); }); });}

 

[jQ]使用jQuery將多條資料插入模態框的方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.