struts2+jquery回调函数得不到
action里面的操作执行了 就是回调函数得不到
jsp页面
function add(id){//uid 为商品id cid为商品数量
$("#13").load("index_add.action",{id:id},function(date){
var s=date;
alert(s);
if(date=="ok1"){
alert("a");
$("#add_"+id).val("已关注");
var add=$("#add_"+id).val();
alert(add);
}
});
}
action页面
*/
public String add() throws
IOException{
HttpServletResponse response = ServletActionContext.getResponse();
PrintWriter out = response.getWriter();
String id=ServletActionContext.getRequest().getParameter("id");
Userinfo users=userService.getByID(Integer.parseInt(id));
Attention att=new Attention();
att.setUserinfoByAttuid(user);
att.setUserinfoByAuid(users);
int row=attenService.saveAttention(att);
if(row!=0){
out.print("ok1");
return "ok1";
}
return "no";
}
Struts.xml
<package name="vote" namespace="/" extends="struts-default">
------解决方案--------------------
这么久没都没人。。。回答。。。。好在找到解决办法。。。用josn