一颗豆子
一颗豆子
  • 发布:2015-12-16 09:48
  • 更新:2015-12-16 09:48
  • 阅读:1775

mui.ajax保错error:internet server error

分类:MUI

通过ajax访问后台的action,在action中已经获取到ajax传来的参数并成功处理return了一个字符串,但在ajax回调函数中却没有进到success中,而是进入error报错internet server error,代码:
前台ajax:
mui.ajax("http://服务器ip:port/program/login", {
data: {
ucode: loginInfo.account,
upawd: loginInfo.password
},
type: "post",
dataType:"text",
timeout:10000,
success: function(data) {
plus.nativeUI.toast(data);
if (data== "2") {
return callback('用户不存在');
} else if (data == "3") {
return callback('密码错误');
} else if (data == "4") {
return callback('用户被锁定');
} else if (data == "31") {
return callback('达到Licence最大数');
} else if (data== "error") {
return callback('系统异常,请稍后再试');
} else{
plus.nativeUI.toast('返回success' + data);
return owner.createState(loginInfo.account, data, callback);
}
},
error:function(xhr,type,errorThrown){/"timeout", "error", "abort", "parsererror"/
plus.nativeUI.toast(type+":"+errorThrown);
}
});
后台action:
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String applogin(HttpServletRequest req, HttpServletResponse resp) {
String ucode = req.getParameter("ucode");
String upawd = req.getParameter("upawd");
LoginResponseDTO ncResp = null;
String result = "";
try {
ncResp = this.userService.login(ucode, upawd);
if (ncResp.isLoginSuccess()) {
// 用户名密码校验成功后发送token
result = ncResp.getNCToken().toString();
} else {// 登录出错,Level : 1
result = String.valueOf(ncResp.getErrorCode());
}
} catch (Exception e) {// 登录发生异常,Level : 0
result = "error";
}
return result;
}
来个大神帮解决。。。。

2015-12-16 09:48 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复