Jquery Ajax 异步设置Table中某列的值
可根据table中某列中的ID去改变某列的值!
只是参考,实际应用中不能这样做的,如果有很多行,频繁访问服务器,服务器是顶不住的!
JS:
$(document).ready(function () {
setTimeout(GetDate, 1000);
});
function GetDate() {
$("#tbData tbody").find("tr").each(function () {
var prjectBalanceObj = $(this).find("td:eq(3)");
var xmbhObj = $(this).find("td:eq(0)").html();
$.ajax({
type: "get",
async: true,
url: "ashx/GetData.ashx?id=" + $(this).find("td:eq(1)").html(),
contentType: "application/x-www-form-urlencoded; charset=utf-8",
beforeSend: function (XMLHttpRequest) {
},
success: function (data, textStatus) {
prjectBalanceObj.html(data);
},
complete: function (XMLHttpRequest, textStatus) {
//alert("XMLHttpRequest:" + XMLHttpRequest + "--textStatus" + textStatus);
},
error: function () {
//alert("获取数据出错");
}
});
})
}
HTML:
<h2>Jquery Ajax 异步设置Table某列的值</h2>
<table class="bordered" id="tbData" >
<thead> <tr>
<th>No</th>
<th>ID</th>
<th>名称</th>
<th>金额</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>001</td>
<td>编码1</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>002</td>
<td>编码2</td>
<td></td>
</tr>
<tr> <td>3</td>
<td>003</td>
<td>编码3</td>
<td></td>
</tr>
<tr>
<td>4</td>
<td>004</td>
<td>编码4</td>
<td></td>
</tr>
<tr>
<td>5</td>
<td>005</td>
<td>编码5</td>
<td></td>
</tr>
</tbody>
</table>
效果:
(VS2010)源码:
http://files.cnblogs.com/files/longwu7456/Jquery_Ajax_Table_Demo.rar
Jquery Ajax 异步设置Table中某列的值的更多相关文章
- jQuery.ajax() 如何设置 Headers 中的 Accept 内容
其实很简单,首先如果是常见类型,则请直接设置 dataType 属性 $.ajax({ dataType: "json", type: "get", succe ...
- 浅析jquery ajax异步调用方法中不能给全局变量赋值的原因及解决方法(转载)
在调用一个jquery的ajax方法时我们有时会需要该方法返回一个值或者给某个全局变量赋值,可是我们发现程序执行完后并没有获取到我们想要的值,这时很有可能是因为你用的是ajax的异步调用async:t ...
- 使用 jQuery Ajax 异步登录,并验证用户输入信息(maven)
使用 jQuery Ajax 异步登录,并验证用户输入信息(maven) 本篇内容: (1)上一篇是使用同步的请求实现登录,并由 Servlet 决定登陆后下一步做哪些事情,本篇使用 jQuery A ...
- OAF TABLE中第一列添加事件不生效
我遇到一个比较诡异的现象 在TABLE中,我在TABLE的第一列添加了一个MessageCheckBox,并为其设置全局刷新的FireAction事件selection, 但是点击勾选框按钮之后,事件 ...
- MySQL 建表语句 create table 中的列定义
MySQL 建表语句 create table 中的列定义: column_definition: data_type [NOT NULL | NULL] [DEFAULT default_value ...
- jquery ajax 超时设置
自:jquery ajax超时设置 var ajaxTimeoutTest = $.ajax({ url:'', //请求的URL timeout : 1000, //超时时间设置,单位毫秒 typ ...
- jquery ajax在 IE8/IE9 中无效
你们是不是也曾经和我以为遇到过这样的情况呢,jquery ajax在 IE8/IE9 中无效获取不到数据呢,经过熬夜找到好的东西和你们分享一下就是jQuery-ajaxTransport-XDomai ...
- jquery ajax post 传递数组 ,多checkbox 取值
jquery ajax post 传递数组 ,多checkbox 取值 http://w8700569.iteye.com/blog/1954396 使用$.each(function(){});可以 ...
- GridView控件RowDataBound事件中获取列字段值的几种途径
前台: <asp:TemplateField HeaderText="充值总额|账号余额"> <ItemTemplate> <asp:Label ID ...
随机推荐
- 使用C#选择文件夹、打开文件夹、选择文件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- [转载]线程间操作无效: 从不是创建控件“ListBox1”的线程访问它
解决方法有两种: 1.Control.CheckForIllegalCrossThreadCalls = false 2.用委托解决线程安全问题
- Android开发之onClick事件的三种写法(转)
package a.a; import android.app.Activity; import android.os.Bundle; import android.view.View; import ...
- leetcode2 Two Sum II – Input array is sorted
Two Sum II – Input array is sorted whowhoha@outlook.com Question: Similar to Question [1. Two Sum], ...
- Host Definition
Description: A host definition is used to define a physical server, workstation, device, etc. that r ...
- [转]掌握 ASP.NET 之路:自定义实体类简介 --自定义实体类和DataSet的比较
转自: http://www.microsoft.com/china/msdn/library/webservices/asp.net/CustEntCls.mspx?mfr=true 发布日期 : ...
- [itint5]支持删除的后继查询
http://www.itint5.com/oj/#49 这一题一开始想到是用HashSet+链表来做,链表记录prev和next.这样也可以,后来看到都是连续的整数,而且交流了一下觉得可以用类似并查 ...
- 【转】linux常用命令全集
linux常用命令全集
- C#.Net 如何动态加载与卸载程序集(.dll或者.exe)2----通过应用程序域AppDomain加载和卸载程序集之后,如何再返回原来的主程序域
实现目的:动态加载dll,执行完毕之后可以随时卸载掉,并可以替换这些dll,以在运行中更新dll中的类. 其实就是通过应用程序域AppDomain加载和卸载程序集. 在这方面微软有篇文章http:// ...
- dp和px,那些不得不吐槽的故事——Android平台图
http://blog.sina.com.cn/s/blog_6499f8f101014ipq.html 一个优秀的手机软件,不仅要有精巧的功能,流畅的速度,让人赏心悦目的UI也往往是用户选择的重要理 ...