Hello,
I am trying to use the JSON plug-in for the first time. I have a form
that uses jquery to submit to a struts2 action, the action is being
invoked properly and I am trying to send result back to call back
function, but when result returns the browser prompts me to save or
open the result file. I expeced the result to be sent to my call back
function, which appears to not be invoked.
I am using Stuts 2.1.8.1
What am I doing wrong?
My form is submitted as such:
function submit(){
$.ajax({
type : "POST",
cache : false,
url : "./myaction.do",
data : $(this).serialize(),
success: function(json) {
$("#result").html(json);
}
});
return false;
}
My action is configured in the struts.xml:
<package name="mypkg" namespace="/def" extends="json-default">
<action name="addNote" class="..myClass" method="addData">
<result type="json">
<param name="root">jsonData</param>
</result>
</action>
</package>
In the action/method I have a hashmap that I am putting result into:
Map<String, String> jsonData= new HashMap<String,String>();
jsonData.put("result", "success");
Any reply appreciated. Thanks in advance!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]