JSP页面:
—————————————————————————————————————————
<html>
<head>
<script type="text/javascript" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript">
$(function(){
$("#submit").click(function(){
$.ajax({
type:"post",
dataType:"json",
url:"auditcustomer",
data:"customerid="+$('p').text()+"&checked="+$('select').val(),
success:function(data){
alert("success");
},
error:function(data){
alert("fail");
}
});
});
});
</script>
</head>
<body>
<p><%=customer.getCustomerId() %></p> <br>
<SELECT id="select" >
<OPTION value="1">通过</OPTION>
<OPTION value="0">未通过</OPTION>
</SELECT>
<div><input id='submit' type=button value="submit"></div>
</body>
</html>
————————————————————————————————
Action类:
——————————————————
public class CustomerAuditAction extends ActionSupport {
private String customerid;
private String checked;
public String AuditCustomer(){
customerauditdao.auditCustomer(customerid,checked);//执行数据库操作
return SUCCESS;
}
}
————————————————————————
Struts配置:
————————————————————————
<package name="" extends="struts-default" namespace="/">
<action name="auditcustomer" class="com.action.CustomerAuditAction" method="AuditCustomer">
<result name="success" ></result>
</action>
</package>
————————————————————————————
Action里数据库操作能正常执行,执行完以后返回给前台 不执行成功的回调函数,即不执行alert("success").在firedebug里报下面的错误:
HTTP Status 404 - result 'null' not found
type Status report
message result 'null' not found
description The requested resource (result 'null' not found) is not available.
largeQ