JQueryAjax - post() 方法为什么执行不了?
js:$(document).ready(function(){$("#stustuid").change(function(){varsid=$("#stustuid"...
js:
$(document).ready(function() {
$("#stustuid").change(function() {
var sid= $("#stustuid").val();
alert(sid);
$.post("checkStuIdAction.action",{stuid:sid},
function(date,state) {
alert(date);
alert(state);
return false;
},'json');
});
});
配置文件:
<action name="checkStuIdAction" class="action.StuAction" method="checkStuIdAction">
<result name="CheckStuId" type="json">/page/stuMessage/addStuMessage.jsp</result> </action>
checkStuIdAction:
public String checkAction() throws Exception {
StringBuffer hql = new StringBuffer();
System.out.println(stuid);
hql.append("from StuInformationTwo s where stustuid = '" + stuid + "'");
List<Object> sa = new ArrayList<Object>();
sa = this.dao.findByHql2(hql.toString(), null);
if (sa.size() <= 0) {
this.result = "ok";
} else {
this.result = "no";
}
return "CheckStuId";
} 展开
$(document).ready(function() {
$("#stustuid").change(function() {
var sid= $("#stustuid").val();
alert(sid);
$.post("checkStuIdAction.action",{stuid:sid},
function(date,state) {
alert(date);
alert(state);
return false;
},'json');
});
});
配置文件:
<action name="checkStuIdAction" class="action.StuAction" method="checkStuIdAction">
<result name="CheckStuId" type="json">/page/stuMessage/addStuMessage.jsp</result> </action>
checkStuIdAction:
public String checkAction() throws Exception {
StringBuffer hql = new StringBuffer();
System.out.println(stuid);
hql.append("from StuInformationTwo s where stustuid = '" + stuid + "'");
List<Object> sa = new ArrayList<Object>();
sa = this.dao.findByHql2(hql.toString(), null);
if (sa.size() <= 0) {
this.result = "ok";
} else {
this.result = "no";
}
return "CheckStuId";
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询