html页面代码:
mui.ajax({
type: "get",
url: "http://192.168.0.101:8081/fzyzjk/business/app/ajaxLogin.html",
async: true,
data: {
uphone: uphone,
upassword: upwd
},
dataType: "json",
timeout: 1000,
success: function(data) {
//[{"alreadyLogined":false,"defaultPassword":false,"loginSuccess":false,"permissionEntity":null,"result":0,"user":{}}]
var jsdata=JSON.stringify(data);
var ret=jsdata.status;
console.log(ret);
以下省略
===================================================================
返回的json数据:
[{"alreadyLogined":false,"defaultPassword":false,"loginSuccess":false,"permissionEntity":null,"result":0,"user":{}}]
var jsdata=JSON.stringify(data);
var ret=jsdata.status;(这里ret没取到,控制台输出为:undefined)
这是为何呢?谢谢了。
================以下是java后台======================================
String uphone = request.getParameter("uphone");
String upassword = request.getParameter("upassword");
Map userMap = appInterfaceService.getUserByLoginName(uphone);
Map retMap=new HashMap();
retMap.put("user", userMap);
retMap.put("status", "3");
//用户名不存在
if (userMap == null || userMap.isEmpty()) {
retMap.put("status",""+(LoginEntity.Login_Result_UserNameNotExists));
}else{
//用户名或密码错误
if (!EqualUtil.isStringEqual(userMap.get("PASSWORD"),appInterfaceService.getEncodedPassword(upassword))) {
retMap.put("status",""+(LoginEntity.Login_Result_PassowrdError)+"");
}
//用户被禁用
if (EqualUtil.isStringEqual(userMap.get("ZT"), "2")) {
retMap.put("status",""+(LoginEntity.Login_Result_LoginForbid)+"");
}
}
System.out.print( JsonUtil.obj2Json(retMap));
WebUtil.write(response, JsonUtil.obj2Json(retMap));
yomz
你好,picker的demo中,选择后输出的json数组如何不带双引号呢?求解谢谢!userResult.innerText = JSON.stringify(items[0].text);
2016-03-14 23:26
yomz
加了parse解决了,谢谢!
2016-03-14 23:34