您好,我正在尝试刷新我的MVC视图页面,该页面使用以下代码显示来自数据库的数据
<div id="stuDetails" class="col-md-6 col-xs-12">
<div id="AttendanceStatus" class="ts-intro">
<h2 class="into-sub-title">Live Attendance</h2>
<h3 class="into-title">(@DateTime.Now)</h3>
<table class="mu-blog-caption table">
@foreach (DataRow row in Model.Tables[0].Rows)
{
<tr style="background-color:#30652c; color:#fff;">
<td>
No. of person present in Hotel
</td>
<td>
: @row["No_of_persons_Inn"]
</td>
</tr>
<tr style="background-color:#B73522; color:#fff;">
<td>
No. of person out of the in Hotel
</td>
<td>
: @row["No_of_persons_Out"]
</td>
</tr>
<tr>
<td>
Total
</td>
<td>
: @row["Total_persons"]
</td>
</tr>
<tr>
<td><label id="lblmessage"></label> </td>
<td>
<p> <a class="btn btn-default" href="#">Absent list »</a></p>
</td>
</tr>
}
</table>
</div>
<script type="text/javascript">
$(document).ready(function () {
setInterval("refresh();", 1000);
});
function refresh() {
$("#AttendanceStatus").load("#AttendanceStatus");
</script>
尽管它刷新页面并显示所需的结果,但它干扰了模板并在要刷新的页面中显示整个页面,但我得到的结果如屏幕截图所示。enter image description here