I call a Struts2 action using jQuery Ajax like the following:
$.ajax ({
url: 'callAction.action',
type: 'POST',
data: data,
dataType: 'string',
success: function (data) {
console.log("Success");
}
});
And in response, it has to return a string back to jQuery.
private String result;
//getters and setters
public String call()
{
//some code
result= "some string";
return SUCCESS;
}
I want to retrieve the result
from the function in the Struts action to jQuery. How would I make this possible?