当前位置: 代码迷 >> J2EE >> struts2+jquery回调函数得不到,该怎么解决
  详细解决方案

struts2+jquery回调函数得不到,该怎么解决

热度:94   发布时间:2016-04-22 01:03:58.0
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
  相关解决方案