After click the button, the value of partid is passed to action class, and see the output '123' from the console. the assigned value of dummymesg is displayed on the console as well. but the dummymesg never return to front javascript. looks like success or error function call never be called, please advise thanks in advance
Cart.jsp <script type="text/javascript">$(function() { $("#deleteButton").click(function(){ $.ajax({ type: "POST", url: "cart-del!del.action", data: {'partid':'123'}, dataType:"json", success: function(json){ console.log("return success"); var obj = $.parseJSON(json); alert("dummey mesg="+obj.dummymesg); return false; }, error: function(json){ console.log("return error = "+json); alert("json=" + json); return false; } }); }); });</script><button id="deleteButton">delete</button> struts.xml<package name="default" extends="json-default"> ... <action name="cart-del" class="CartAction" method="del"> <result name="json-data" type="json"></result> </action> </package> CartAction.java public class CartAction extends ActionSupport { private String partid; public void setPartid(String partid) { this.partid=partid.trim(); } public String getPartid() { return partid; } public void setDummymesg(String dummymesg) { this.dummymesg=dummymesg; } public String getDummymesg() { return dummymesg; } public String del() throws Exception { dummymesg="struts function reached"; System.out.println("cart-del, partid="+partid+"\n"); System.out.println("cart-del, dummymesg="+dummymesg+"\n"); return "json-data"; } }