各位帮忙看看 新手谢谢
function addInfor(foo){
$.ajax({
cache :false,
async: false,
url:'${ctx}/fgl/fgl!addInfo.action?fphInfo='+foo,
success:function (data){
alert("!!!!!!!!!");
}
});
}
action内容如下:
public void addInfo() throws IOException{
String foo =request.getParameter("fphInfo");
fpglFy = fglService.getByFph(foo);
xsInfo = fpglFy.getXs();
xxInfo = fpglFy.getXx();
// HttpSession session = request.getSession();
// session.setAttribute("xsInfo", xsInfo);
// session.setAttribute("xxInfo", xxInfo);
}
action中打断点xsInfo 和xxInfo 都有值
我怎么把这两个值取到alert("!!!!!!!!!");下面好给页面的文本框赋值?
------解决方案--------------------public void addInfo() throws IOException{
String foo =request.getParameter("fphInfo");
fpglFy = fglService.getByFph(foo);
xsInfo = fpglFy.getXs();
xxInfo = fpglFy.getXx();
// HttpSession session = request.getSession();
// session.setAttribute("xsInfo", xsInfo);
// session.setAttribute("xxInfo", xxInfo);
out.print(xsInfo);
}
alert(data)
试试
------解决方案--------------------JSONObject data = new JSONObject();
data.put("xsInfo",xsInfo );
data.put("xsInfo",xxInfo );
this.outJsonString(data.toJSONString());
alert(data.xsInfo);
alert(data.xxInfo);