This time I will bring you how to implement jquery to load data immediately on the startup page, and implement jquery to load data immediately on the startup page. What are the precautions?The following is a practical case, let's take a look.
In fact, the important thing is this method:
$(document).ready(function(){ }
Specifically in jquery:
For specific how to use ajax, you can check out my last blog "A brief discussion of ajax requests in jquery and responses in 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>
in jsp:
<p class="tab-pane active" id="A" style="text-align:center;"> <p 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> </p> </p>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website Other related articles!
Recommended reading:
Realize the linkage effect between the input box and the drop-down box
##Use jquery to operate the text content of the input box
The above is the detailed content of Implement jquery to load data immediately on the startup page. For more information, please follow other related articles on the PHP Chinese website!