
使用JQuery插件DataTables,报错:Uncaught TypeError: Cannot read property 'length' of undefined 10
使用JQuery插件DataTables,报错:UncaughtTypeError:Cannotreadproperty'length'ofundefined后台返回的J...
使用JQuery插件DataTables,报错:Uncaught TypeError: Cannot read property 'length' of undefined后台返回的 JSON 数据格式没问题,用浏览器 network 查看网络请求也成功了。后台使用的是 Java springMVC+myBatis。以下是返回的 JSON 数据:{"code":"200","data":[{"lastLoginTime":"2018-01-13 18:10:01.0","gender":"man","registerTime":"2018-01-13 18:10:01.0","nickName":"雨田三石","icon":"/default/man.jpg","authType":2,"userId":1,"account":"17396486424"},{"lastLoginTime":"2018-01-13 18:10:01.0","gender":"man","registerTime":"2018-01-13 18:10:01.0","nickName":"黑策策","icon":"/default/man.jpg","authType":1,"userId":2,"account":"17070882754"},{"lastLoginTime":"2018-01-13 18:10:01.0","gender":"man","registerTime":"2018-01-13 18:10:01.0","nickName":"凉岛","icon":"/default/man.jpg","authType":2,"userId":3,"account":"17717489245"},{"lastLoginTime":"2018-01-13 18:10:02.0","gender":"woman","registerTime":"2018-01-13 18:10:02.0","nickName":"陆颗","icon":"/default/woman.jpg","authType":2,"userId":4,"account":"17252643120"},{"lastLoginTime":"2018-01-13 18:10:02.0","gender":"woman","registerTime":"2018-01-13 18:10:02.0","nickName":"沫汨","icon":"/default/woman.jpg","authType":2,"userId":5,"account":"18691745414"},{"lastLoginTime":"2018-01-13 18:10:02.0","gender":"man","registerTime":"2018-01-13 18:10:02.0","nickName":"狐狸飞","icon":"/default/man.jpg","authType":2,"userId":6,"account":"13174552044"},{"lastLoginTime":"2018-01-13 18:10:03.0","gender":"man","registerTime":"2018-01-13 18:10:03.0","nickName":"何文通","icon":"/default/man.jpg","authType":2,"userId":7,"account":"17250880927"},{"lastLoginTime":"2018-01-13 18:10:03.0","gender":"man","registerTime":"2018-01-13 18:10:03.0","nickName":"布林","icon":"/default/man.jpg","authType":2,"userId":8,"account":"17289452078"},{"lastLoginTime":"2018-01-13 18:10:04.0","gender":"woman","registerTime":"2018-01-13 18:10:04.0","nickName":"多肉星人","icon":"/default/woman.jpg","authType":2,"userId":9,"account":"13540770412"},{"lastLoginTime":"2018-01-13 18:10:05.0","gender":"woman","registerTime":"2018-01-13 18:10:05.0","nickName":"王安静","icon":"/default/woman.jpg","authType":2,"userId":10,"account":"18992210467"}],"msg":"获取用户列表成功!"}
展开
1个回答
展开全部
目测是因为分页参数问题,如果不是请忽略
没开分页可以直接传集合转化为json,开分页一般需要{total:100,rows={ {},{} }}这种形式,jq读取rows为空,找不到rows.length属性就会报这种错;
具体的可以参看一下帮助文档有没有类似的说明,
没开分页可以直接传集合转化为json,开分页一般需要{total:100,rows={ {},{} }}这种形式,jq读取rows为空,找不到rows.length属性就会报这种错;
具体的可以参看一下帮助文档有没有类似的说明,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |