這是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;}現(xiàn)在的問題是當(dāng)action中的返回值name為null時回調(diào)函數(shù)成功執(zhí)行,即alert,但是當(dāng)name不為空時卻不執(zhí)行回調(diào)函數(shù)了,什么情況?
2 回答

森欄
TA貢獻1810條經(jīng)驗 獲得超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 關(guān)注
- 102 瀏覽
添加回答
舉報
0/150
提交
取消