$("#jqGridList").jqGrid({
url:"web/admin/accountsMgr/searchUserList.form",
datatype: "json",
...
});获取数据乱码,在后台中输出是正确,后台显示却显示问号。
后台调试显示中文正常,前台显示乱码。
这个明显就是输出编码没有设置正确造成的结果。
你单独请求web/admin/accountsMgr/searchUserList.form,看看返回的json是什么样的
这是返回json:{"total": "1", "page": "1", "records": "2", "rows": [{"id":"402881ef4b241dea014b242020e30000","userName":"???","userTel":"18569514619","userSex":"?","bankCard":"622700301010234","cardStatus":"1","createTime":"1970-01-01 10:44:20.0"},{"id":"402881ef4b241dea014b24227d110001","userName":"???","userTel":"18874442871","userSex":"?","bankCard":"622700301123257","cardStatus":"1","createTime":"1970-01-01 10:46:54.0"}]}
然而后台输出却是正常的。
{"total": "1", "page": "1", "records": "2", "rows": [{"id":"402881ef4b241dea014b242020e30000","userName":"小米""userTel":"18569514619","userSex":"男","bankCard":"622700301010234","cardStatus":"1","createTime":"1970-01-01 10:44:20.0"},{"id":"402881ef4b241dea014b24227d110001","userName":"小菜","userTel":"18874442871","userSex":"女","bankCard":"622700301123257","cardStatus":"1","createTime":"1970-01-01 10:46:54.0"}]}
@yuanfy008: "userName": "小米""userTel": "18569514619",
后台传回的数据 小米 和 userTel 中间缺少了一个逗号
@刘宏玺: 这刚我误删了下,本身输出是有的。
@yuanfy008: 你给个完整的出来,我觉得是数据的问题
@刘宏玺: {"total": "1", "page": "1", "records": "2", "rows": [{"id":"402881ef4b241dea014b242020e30000","userName":"小米","userTel":"18569514619","userSex":"男","bankCard":"622700301010234","cardStatus":"1","createTime":"1970-01-01 10:44:20.0"},{"id":"402881ef4b241dea014b24227d110001","userName":"小蔡","userTel":"18874442871","userSex":"女","bankCard":"622700301123257","cardStatus":"1","createTime":"1970-01-01 10:46:54.0"}]}
因为银行卡号,开通时间都是正确的,比较怀疑数据本身出了问题。
数据本身? 我数据库里面都是显示正常,后台输出也正常呀。
@yuanfy008: 从你的数据来看,后台对的,到页面就错了。检查下编码问题。
@幻天芒: 可是我jsp页面设置的是utf-8