jquery在啟動頁面時,自動載入資料的執行個體,jquery執行個體

來源:互聯網
上載者:User

jquery在啟動頁面時,自動載入資料的執行個體,jquery執行個體

其實,重要的就是這個方法:

$(document).ready(function(){ } 

具體的在jquery中:

具體的ajax怎麼使用,可以查看我的上一篇部落格《淺談ajax在jquery中的請求和servlet中的響應》

<script type="text/javascript"> $(document).ready(function(){var str = "";var strA = "";  $.ajax({ type: "GET",  url: "<%=path%>" + "/queryOrder.do",  dataType: "json",  async:false,  data:{      },  success: function(data){  for (var i in data)  {  var num = parseInt(i) + 1;  var status = data[i]['status'];  if( status == 0 || status == -4){  strA = '<a class="m1" value="'+ data[i]['orderId'] +'">未處理</a>';  }else if( status == -1 || status == -2){  strA = '<a class="m2" value="'+ data[i]['orderId'] +'">已接受</a>';  }else if( status == -3){  strA = '<a class="m3" value="'+ data[i]['orderId'] +'">已完成</a>';  }  str +="<tr><td>" + num + "</td><td>"   + data[i]['ownerName'] + "</td><td>"   + data[i]['telephone'] + "</td><td>"   + data[i]['hopeTimeName'] + "</td><td>"   + data[i]['build'] + "</td><td>"  + data[i]['description'] + "</td><td>"  + strA + "</td>";  + "</tr>";  }  $(".tabletr").after(str);  },  error: function(data){    } })  });</script>

在jsp中:

<div class="tab-pane active" id="A" style="text-align:center;">   <div class="row marg" >    <h3>維修單</h3>    <table border="2 " style="width:100%;text-align:center;">     <tr class="tabletr">     <th>序號</th>     <th>業主名</th>     <th>連絡方式</th>     <th>時間</th>     <th>地址</th>     <th>項目描述</th>     <th>狀態</th>     </tr>    </table>    </div> </div>

以上這篇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.