ajax局部更新
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局部更新的更多相关文章
- ASP.Net Core使用Ajax局部更新
由于目前ASP.NET Core中没有提供Ajax帮助器,所以参照 上一篇帖文,使用data-ajax-*属性来使用jQuery Unobtrusive Ajax功能实现HTML的局部页面元素更新. ...
- AJAX局部更新演出排期
<script language="javascript" type="text/javascript"> function createXMLHt ...
- 【SSH网上商城项目实战28】使用Ajax技术局部更新商品数量和总价
转自: https://blog.csdn.net/eson_15/article/details/51487323 昨天把项目部署了一下,玩了玩,今天完善了一下购物车中修改商品数量就能局部 ...
- winform 实现局部更新(如ajax实现)而整个界面不产生闪烁的解决方案
转自原文winform 实现局部更新(如ajax实现)而整个界面不产生闪烁的解决方案 一.通过对窗体和控件使用双缓冲来减少图形闪烁(当绘制图片时出现闪烁时,使用双缓冲) 对于大多数应用程序,.NET ...
- .Net页面局部更新的思考
最近在修改以前做的模块,添加一个新功能.整理了下才发现重用率很低,大部分的东西还是需要重新写.功能里用到了局部更新,所有整理一下一路来实现局部更新的解决方案及改进. 我接触的项目开发大多是以Asp.n ...
- ajax局部刷新
//5秒刷新一次 $(function () { setInterval(Refresh, 5000); }); //ajax局部刷新 function Refresh() { $.ajax({ ty ...
- php Ajax 局部刷新
php Ajax 局部刷新: HTML部分 </head> <body> <h1>Ajax动态显示时间</h1> <input type=&quo ...
- WebApiClient的JsonPatch局部更新
1. 文章目的 随着WebApiClient的不断完善,越来越多开发者选择WebApiClient替换原生的HttpClient,本文将介绍使用WebApiClient来完成JsonPatch提交的新 ...
- 通过Solrj实现对索引库中数据的局部更新操作
for (UpdateIndexDTO updateIndexDTO : data) { // 局部更新 SolrInputDocument doc = new SolrInputDocument() ...
随机推荐
- Linux常用指令---系统管理
四.linux服务器" [have no space]"开发机dev2上不管是upa/upc上传文件时,会挂载在/目录下,而此时这里只有3G空间,通过df -h显示各大挂载点使用情 ...
- Android -- 使用inBitmap要注意的地方
SDK版本 需要注意的是inBitmap只能在3.0以后使用.2.3上,bitmap的数据是存储在native的内存区域,并不是在Dalvik的内存堆上. 在android3.0开始,系统在Bitma ...
- 20135220谈愈敏Linux Book_3
第3章 进程管理 进程是Unix操作系统抽象概念中最基本的一种,进程管理是操作系统的心脏所在. 3.1 进程 进程:处于执行期的程序以及相关的资源的总称. 线程:在进程中活动的对象,拥有独立的程序计数 ...
- 路由器 NorFlash与NandFlash区别
在淘宝上买修改openwrt的路由器,基本上都是改的16MB flash,那么为什么不改到1GB呢? 现在U盘的价格也很便宜啊. 于是我调查了一下,发现flash分为两种,NorFlash与NandF ...
- MVC5 + EF6 + Bootstrap3 (7) Bootstrap的栅格系统
文章来源: Slark.NET-博客园http://www.cnblogs.com/slark/p/mvc5-ef6-bs3-get-started-grid.html 上一节:ASP.NET MVC ...
- [软件测试]Linux环境中简单清爽的Google Test (GTest)测试环境搭建(初级使用)
本文将介绍单元测试工具google test(GTEST)在linux操作系统中测试环境的搭建方法.本文属于google test使用的基础教程.在linux中使用google test之前,需要对如 ...
- jQuery基础之(三)jQuery功能函数前缀及与window.onload冲突
1.jQuery功能函数前缀 在javascript中,开发者通常会编写一些小函数来处理各种操作细节,例如在用户提交表单时,要将文本框最前端和最末端的空格内容清理掉.而javascript中没有类似t ...
- Beta版本贡献比
学号 姓名 贡献率 031302301 毕容甲 25%031302302 蔡逸轩 25%031302430 肖阳 25%031302418 黄彦 ...
- Android Studio快速添加Gson以及GsonFormat的使用
目录: 一.Android Studio快速添加Gson 二.Android Studio中GsonFormat的使用 三.在线JSON校验格式化工具 一.Android Studio快速添加Gson ...
- hdu1255 矩阵的交 线段树+扫描线
/* 不是叶子节点 ,且cnt=1.注意这里,cnt=1确切的意义是什么, 应该是,可以确定,这个区间被完全覆盖了1次, 而有没有被完全覆盖两次或以上则不知道无法确定,那么怎么怎么办了, 只要加上t[ ...