首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

各位帮忙看看 新手多谢

2012-05-21 
各位帮忙看看 新手谢谢function addInfor(foo){$.ajax({cache :false,async: false,url:${ctx}/fgl/fgl!a

各位帮忙看看 新手谢谢
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);

热点排行