ajax,页面怎么接收php返回的二维数组,

WBOY
Release: 2016-06-13 13:46:58
Original
1111 people have browsed it

ajax,页面如何接收php返回的二维数组,急!!!
我用的ajax请求一个php,
在php文件里,用json_encode()这个函数将返回二维数组格式化了,
javascript是用xmlHttp.responseText接收,但是好像直接不能
做为二维数组应用,他是不是还要转化成Object对象类型的?

------解决方案--------------------
接收后需要使用JavaScript的eval进行处理后,才是Json对象。
像下面这样。

JScript code

var obj_json = eval(xmlHttp.responseText);
alert(obj_json.id); <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template