mvc3 Razor页面ajax问题 我在view页面动态绑定了一个table,我想用ajax每隔几秒钟重新绑定下这个table,如何去实现,本人刚接触mvc3,不是很懂,望各位兄弟帮忙,最好有代码示例,view的跟controller的,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <table cellpadding="0" cellspacing="0" border="0" id="table_1" class="uiTable report"> <thead> <tr> <th width="16px;"><h3></h3></th> <th><h3>车站名称</h3></th> <th><h3>工作状态</h3></th> <th width="16px;"><h3></h3></th> <th><h3>车站名称</h3></th> <th><h3>工作状态</h3></th> <th width="16px;"><h3></h3></th> <th><h3>车站名称</h3></th> <th><h3>工作状态</h3></th> </tr> </thead> <tbody> @{ var row = 1; } @foreach (var item in Model) { if(row == 1) { @:<tr> } if (item.Total > 0) { <td><img src="@Url.Content("~/Content/img/alarm.png")" /></td> <td bgcolor="yellow">@item.STATION_NAME</td> <td bgcolor="yellow"><a href="[email protected]_ID&[email protected]_NAME">异常(@item.Total)</a></td> } else { <td><img src="@Url.Content("~/Content/img/ok.png")" /></td> <td>@item.STATION_NAME</td> <td>正常</td> } if (row == 3) { @:</tr> row = 1; } else { row++; } } @for (int i = row; i < 3; i++) { @:</tr> } </tbody> </table>相关的table是这样的 ajax定时(setInterval)请求了数据了,获取数据后,覆盖现有table数据 能不能给点代码示例,我主要问题在重新绑定数据上,不晓得如何重新绑定table <script type="text/javascript">function LoadData() { $.ajax({ url: "/Home/AjaxLoad", type: "get", success: function (responseText, statusText) { //此处处理数据逻辑,responseText可以是json数据,js处理拼接后加载覆盖table内容 } }); } setInterval("LoadData();", 2000);//如2000表示2秒请求一次</script> javascript调用自定义类中的函数问题!!!!!! 有关ADO.NET的一个问题? 软件放在客户自己的服务器上,如何控制软件的启用或禁用。 asp.net中怎么弹出新的窗口? 再问,是否有人能回答!!! 哪位高手能帮助分析一下以下代码?非高手莫进!在线等待! ashx 数据返回得不到数据 如何知道某个月份有几天? 如何动态改变<asp:HyperLinkColumn Text\DataNavigateUrlFormatString\HeaderText="属性的值"呢>? 升级了,大家快来加入这个群49740,这是ASP.NET交流的地方。 连接就是未初始化 导出功能的问题
<thead>
<tr>
<th width="16px;"><h3></h3></th>
<th><h3>车站名称</h3></th>
<th><h3>工作状态</h3></th>
<th width="16px;"><h3></h3></th>
<th><h3>车站名称</h3></th>
<th><h3>工作状态</h3></th>
<th width="16px;"><h3></h3></th>
<th><h3>车站名称</h3></th>
<th><h3>工作状态</h3></th>
</tr>
</thead>
<tbody>
@{ var row = 1; }
@foreach (var item in Model)
{
if(row == 1) {
@:<tr>
}
if (item.Total > 0)
{
<td><img src="@Url.Content("~/Content/img/alarm.png")" /></td>
<td bgcolor="yellow">@item.STATION_NAME</td>
<td bgcolor="yellow"><a href="[email protected]_ID&[email protected]_NAME">异常(@item.Total)</a></td>
}
else
{
<td><img src="@Url.Content("~/Content/img/ok.png")" /></td>
<td>@item.STATION_NAME</td>
<td>正常</td>
}
if (row == 3)
{
@:</tr>
row = 1;
}
else
{
row++;
}
}
@for (int i = row; i < 3; i++)
{
@:</tr>
}
</tbody>
</table>
相关的table是这样的
<script type="text/javascript">
function LoadData() {
$.ajax({
url: "/Home/AjaxLoad",
type: "get",
success: function (responseText, statusText) {
//此处处理数据逻辑,responseText可以是json数据,js处理拼接后加载覆盖table内容
}
});
}
setInterval("LoadData();", 2000);//如2000表示2秒请求一次
</script>