通过ajax 传入对应数据的id 查询数据,但是返回的数据并不能通过点击实时刷新
每次都需要手动刷新两次 数据才能对应.
<s:form method="post" action="TeacherActionUpdate" id="update" enctype="multipart/form-data">
<div id="lights" class="white_contents" style="text-align: center;overflow-x:visible;">
<table width='100%' cellpadding='0' cellspacing='0' style="text-align: center;position:absolute;left:55px;">
<h3>修改教师信息</h3>
<br/>
<tr class="divcss5-b">
<td width="12.5%" style="text-align: right;">姓名 </td>
<td style="text-align:left;">
<s:textfield name="tc.name" style="width:181px;height:28px;" cssClass="v_null" placeholder="请输入教师名称"/>
</td>
</tr>
<tr class="divcss5-b">
<td width="12.5%" style="text-align: right;">性别 </td>
<td style="text-align:left;">
<select name="tc.sex" style="width:181px;height:28px;">
<option>男</option>
<option>女</option>
</select>
</td>
</tr>
<tr class="divcss5-b">
<td width="12.5%" style="text-align: right;">手机号 </td>
<td width="12.5%" style="text-align:left;">
<s:textfield name="tc.phone" style="width:181px;height:28px;" cssClass="v_tel" placeholder="请输入11位手机号"/>
</td>
</tr>
</table>
<div style="position:absolute;top:630px;left:150px">
<a class="button button-khaki tijiaos">
<span>保存</span>
</a>
<a href="javascript:void(0)" onclick="document.getElementById('lights').style.display='none';" class="button button-khaki">
<span>关闭</span>
</a>
</div>
</div>
</s:form>
<script>
$(function(){
$(".teacherupdate").click(function(){
var id=$(this).text();
alert(id);
document.getElementById('lights').style.display='block';
$.ajax({
url : "TeacherActionFindBy.action",
cache:true,
type : "POST",
data:{'id':id},
async: false,
success: function(result){
alert(1);
}
});
return false;
});
});
</script>