这是js$(function(){var ID = $("#license").html();$("#driver").bind("change",function(){var select = $(this).val();$.post("Vehicle!update_d?vehicle.staff.staffNo="+select+"&vehicle.license="+ID+"",function(data,status){ alert(data);$("#select").html(data);});});});这是actionpublic String update_d() throws Exception{String name = s_dao.findById(vehicle.getStaff().getStaffNo()).getStaffName();return name;}现在的问题是当action中的返回值name为null时回调函数成功执行,即alert,但是当name不为空时却不执行回调函数了,什么情况?
2 回答

森栏
TA贡献1810条经验 获得超5个赞
这是action 错误
public void update_d() throws Exception{
String name = s_dao.findById(vehicle.getStaff().getStaffNo()).getStaffName();
ServletActionContext.getResponse().setContentType("text/javascript;charset=UTF-8");
PrintWriter out = ServletActionContext.getResponse().getWriter();
out.write(name );
}
- 2 回答
- 0 关注
- 85 浏览
添加回答
举报
0/150
提交
取消