用easyui的form组件发ajax得不到响应

小灯光环
博客专家认证
2013-11-18 02:11:14
大致代码如下:

$('#btn_sub').click(function() {
if ($('#type_form').form('validate')) {
$('#type_form').form('submit', {
url : flag == 'save' ? 'addcType.action' : 'updcType.action',
onSubmit : function() {

},
success : function(result) {
console.info(result);这个出不来

});
}
});
}
});


Action:
public String updcType() throws IOException {
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("html/text;charset=UTF-8");
try {
clientTypeService.updTypes(clientType);
String jsonSuccess = "{\"status\":\"ok\",\"message\":\"操作成功\"}";
System.out.println("Action已执行完毕");
response.getWriter().write(jsonSuccess);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
String jsonFailure = "{\"status\":\"failure\",\"message\":\"操作失败\"}";
response.getWriter().write(jsonFailure);
}
return null;
}


1、我的添加好好的,就是这个修改出问题,一模一样的代码。
2、我访问这个Action,居然给我弹出下载框,让我下载xxx.action文件,很奇怪!
3、通过firebug观察响应没有得到,提示这句话:“重新载入页面以获取源代码: http://localhost:8080/goods_management_system/basic/updcType.action
4、Action、业务类等等的代码均可正常执行。

总结:前台得不到响应结果。求大神!
...全文
353 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tony4geek 2013-11-18
  • 打赏
  • 举报
回复
你浏览器看下吧。不知道他最终返回的什么样的 。
小灯光环 2013-11-18
  • 打赏
  • 举报
回复
引用 1 楼 rui888 的回复:
contentType 为text/html
改过来是对了。。可是我的删除模块写的“html/text”为什么就没有出错呢??求解啊
tony4geek 2013-11-18
  • 打赏
  • 举报
回复
tony4geek 2013-11-18
  • 打赏
  • 举报
回复
contentType 为text/html

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧