用easyui的form组件发ajax得不到响应
大致代码如下:
$('#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);这个出不来
});
}
});
}
});
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;
}