Home  >  Article  >  Backend Development  >  html getJSON 无效,该怎么解决

html getJSON 无效,该怎么解决

WBOY
WBOYOriginal
2016-06-13 11:50:41873browse

html getJSON 无效
页面 用JQuery  提交到php  但是一用到 getJSON方法 我写的js代码就无效了。用$post()就没事。但是。返回的东西我完全看不懂  php返回的时候用 echo  json_encode($data)  然后回来的数据就是下面这样的

[{null:"6","0":"6",null:"2","1":"2",null:"3","2":"3",null:"3","3":"3",null:".92","4":".92

",null:".15","5":".15",null:".23","6":".23",null:"1.83","7":"1.83",null:".31","8":".31",n

ull:".46","9":".46"}]  
搞了一天完全没的头绪。新手刚接触PHP 三天
框架用的好像是 CI + Smarty  用的之前的项目做的模板。但是 之前的项目查询数据库的时候 字段名什么的全是英文名。。。现在公司全改成中文名称了。。。最苦恼碰到乱码问题了。还有PHP 怎么调试ajax请求还不知道。
------解决方案--------------------
echo  json_encode($data) 
$data 里面的中文必须是 utf-8 的

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn