js

//点击启用
$(".status").on("click",function(){
var id = $(this).attr("statusId");
var customName = $(this).attr("customName");
var customStatus = $(this).attr("value");
var statusId = $(this).attr("statusId");
if(customStatus == 1){
strcustomStatus = "停用";
}else{
strcustomStatus = "启用";
}
alert(customStatus);
//alert(customName);
//alert(id);
ymPrompt.win({
width:260,
height:150,
icoCls: '',
message:'<div style="padding-top:25px;" class="message" align="center">您确定要'+strcustomStatus+'【'+customName+'】这个客户吗?</div>',
titleBar:false,
winPos:'c',
btn:[['OK','ok'],['Cancel','no']],
handler:function getButton(btn){
if(btn == "ok"){
$.ajax({
type:"Post",
data:{"customStatus":customStatus,"id":id},
dataType:"json",
url:classpath+"/updatecustomStatus",
success:function(data){
if(data.customStatus==1){
//点击
$("span[statusId='"+statusId+"']").val(1);
$("span[statusId='"+statusId+"']").html("<font color='red'>停用</font>");
$("#"+statusId+"").val(0);
$("#"+statusId+"").html("启用");
}else{
$("span[statusId='"+statusId+"']").val(0);
$("span[statusId='"+statusId+"']").html("启用");
$("#"+statusId+"").val(1);
$("#"+statusId+"").html("<font color='red'>停用</font>");
}
}
});
}
}
});

页面

    <s:form  id="form" method="post">
<table align="center" width="960" height="30" border="1px solid" id="find"/>
<tr align="center" cellpadding="0">
<th width="65px">序号</th>
<th width="220px">客户名称</th>
<th width="200px">法人代表</th>
<th width="180px">注册时间</th>
<th width="80px">类型</th>
<th width="80px">状态</th>
<th width="135px">操作</th>
</tr>
<s:iterator value="customsPageSupport.result" var="c" status="status">
<tr align="center">
<td>
<s:property value="#status.index+1"/>
</td>
<td><s:property value="customName"/></td>
<td><s:property value="bossName"/></td>
<td><s:date name="regDatetime" format="yyyy-MM-dd"/></td>
<td><s:property value="customTypeName"/></td>
<td>
<span id="${c.id}" style="color:green" firststatusId="${c.id }" value="${c.customStatus }"><s:if test="customStatus == 1">启用</s:if>
<font color="red"><s:else>停用</s:else></font></span>
</td>
<td>
<span style="cursor:pointer" class="find" findId="${c.id }" >查看</span>
<span style="cursor:pointer" class="update" updateId="${c.id }">修改</span>
<span id="secondspan" style="color:green;cursor:pointer" class="status" statusId="${c.id }" value="${c.customStatus }" customName="${c.customName }"><s:if test="customStatus == 0">启用</s:if>
<font color="red"><s:else>停用</s:else></font></span>
</td>
</tr>
</s:iterator>

ajax局部更新的更多相关文章

  1. ASP.Net Core使用Ajax局部更新

    由于目前ASP.NET Core中没有提供Ajax帮助器,所以参照 上一篇帖文,使用data-ajax-*属性来使用jQuery Unobtrusive Ajax功能实现HTML的局部页面元素更新. ...

  2. AJAX局部更新演出排期

    <script language="javascript" type="text/javascript"> function createXMLHt ...

  3. 【SSH网上商城项目实战28】使用Ajax技术局部更新商品数量和总价

         转自: https://blog.csdn.net/eson_15/article/details/51487323 昨天把项目部署了一下,玩了玩,今天完善了一下购物车中修改商品数量就能局部 ...

  4. winform 实现局部更新(如ajax实现)而整个界面不产生闪烁的解决方案

    转自原文winform 实现局部更新(如ajax实现)而整个界面不产生闪烁的解决方案 一.通过对窗体和控件使用双缓冲来减少图形闪烁(当绘制图片时出现闪烁时,使用双缓冲) 对于大多数应用程序,.NET ...

  5. .Net页面局部更新的思考

    最近在修改以前做的模块,添加一个新功能.整理了下才发现重用率很低,大部分的东西还是需要重新写.功能里用到了局部更新,所有整理一下一路来实现局部更新的解决方案及改进. 我接触的项目开发大多是以Asp.n ...

  6. ajax局部刷新

    //5秒刷新一次 $(function () { setInterval(Refresh, 5000); }); //ajax局部刷新 function Refresh() { $.ajax({ ty ...

  7. php Ajax 局部刷新

    php Ajax 局部刷新: HTML部分 </head> <body> <h1>Ajax动态显示时间</h1> <input type=&quo ...

  8. WebApiClient的JsonPatch局部更新

    1. 文章目的 随着WebApiClient的不断完善,越来越多开发者选择WebApiClient替换原生的HttpClient,本文将介绍使用WebApiClient来完成JsonPatch提交的新 ...

  9. 通过Solrj实现对索引库中数据的局部更新操作

    for (UpdateIndexDTO updateIndexDTO : data) { // 局部更新 SolrInputDocument doc = new SolrInputDocument() ...

随机推荐

  1. DEDECMS中直接通过数据库插入文章

    突然想用爬虫爬来的数据对接DEDECMS,所以研究了一下怎么直接在DEDECMS中直接插入一片文章 (但其实我并没有这样用.因为我直接用前台做的网页,用ajax请求的json数据,其他的都简单,就是没 ...

  2. python数字图像处理(13):基本形态学滤波

    对图像进行形态学变换.变换对象一般为灰度图或二值图,功能函数放在morphology子模块内. 1.膨胀(dilation) 原理:一般对二值图像进行操作.找到像素值为1的点,将它的邻近像素点都设置成 ...

  3. SpringMVC数据验证

    SpringMVC数据验证——第七章 注解式控制器的数据验证.类型转换及格式化——跟着开涛学SpringMVC 资源来自:http://jinnianshilongnian.iteye.com/blo ...

  4. matlab如何读取未知行数,带头文件和字段名的txt文件

    文件格式是这样的 20120108 50024 X235RZB30801 01 15 2361 2362 2363 2364 2365 2366 2367 2368 2369 236A 236B 23 ...

  5. RocEDU.阅读.写作《图解TCP/IP》

    2015年11月21日 一.对本书的认识 信息通信社会这个词俨然是现代社会的一个名词.人们可以使用各种信息终端随时随地的进行交流,而这种环境正是以来网络才得以实现,使用最为广泛的协议就是TCP/IP协 ...

  6. Spring 集成 Hibernate 和 Struts 2

    在Spring中集成Hibernate,实际上就是将Hibernate中用到的数据源DataSource. SessionFactory实例(通常使用Hibernate访问数据库时,应用程序会先创建S ...

  7. IDEA SSH

    被IDEA各种虐0.0各种配置,没有人教就百度,别人也弄了点,然后整整花了一天,从eclipse转到IDEA真的不容易啊TT

  8. Object C学习笔记14-分类(category)

    在.NET中有一个非常带劲的特性,那就是扩展方法. 扩展方法使你能够向现有类型“添加”方法(包括你自定义的类型和对象噢),而无需创建新的派生类型.重新编译或以其他方式修改原始类型.扩展方法是一种特殊的 ...

  9. javascript继承(二)—创建对象的三种模式

    一.工厂模式 function createPerson(name,age){ var o = {}; o.name = name; o.age = age; o.sayHi = function() ...

  10. NumberFormat类的用法

    NumberFormat.getInstance()方法返回NumberFormat的一个实例(实际上是NumberFormat具体的一个子类,例如DecimalFormat), 这适合根据本地设置格 ...