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 foundtype Status reportmessage result 'null' not founddescription The requested resource (result 'null' not found) is not available.
你好,請問jquery.ajax請求action時,回調函數不執行。是什么原因呢?
慕婉清6462132
2022-03-03 15:11:53