I have the following action, I want to pass name to the ajax response. How could I do it ?
public class DatabaseAction extends ActionSupport{
private String name;
public void selectAll() {
name="aa";
}
public void update() {
}
public void delete() {
}
public void add() {
}
public String getName() { return name; }
public void setName(String name) { this.name = name;}
}
I am using JQuery to write the ajax:
$(document).ready(function(){
$("#select").click(function() {
$.ajax({
url:"/db/database!selectAll.action",
type:"POST",
dateType:"JSON",
success:function(name){
alert(name);
}
});
});
$("#delete").click(function() {
alert("delete");
});
});
alert is invoked, but empty result is shown.