标签:
<td colspan="2"> <staff:getDeptHtml name="dept" value="" class="y-select dept" /> <span class="userTd"><staff:getUsersHtml name="user" value="" class="y-select user"/> </span> <input type="text" id="usepersonphone" name="usepersonphone" onkeyup="this.value = this.value.replace(/[^\d.]/g, ‘‘)" onafterpaste="this.value=this.value.replace(/\D/g,‘‘)" class="y-textbox" style="width:150px;" > </td> <g:formRemote name="myForm" onSuccess="deptChangeSucc(data)" class="deptChange" url="[controller: ‘memberCarRepair‘, action: ‘changeDept‘]"> <input type="hidden" name="deptid" id="deptid" type="text" /> </g:formRemote>
$(document).ready(function () { $(".dept").change(function(){ var deptid = $(this).val() $(".deptChange #deptid").val(deptid); $(".deptChange").submit(); }); }); function deptChangeSucc(data){ $(".userTd").html(data) checkApplyPhone() } function checkApplyPhone(){ $("select[name=‘user‘]").change(function(){ var val = $(this).val() if(val!=‘‘){ $.ajax({ type: "post",//使用get方法访问后台 url: "<%=request.getContextPath()%>/memberCooperate/ajaxSelUser",//要访问的后台地址 data: "id="+val,//要发送的数据 success: function(msg){//msg为返回的数据,在这里做数据绑定 $("#usepersonphone").val(msg.phone) $("#useperson").val(msg.realname) } }); }else{ $("#usepersonphone").val(""); } }); }
标签:
原文地址:http://www.cnblogs.com/yu0312chao/p/4863361.html