Question about json in jquery and php

Source: Internet
Author: User
Question about json in jquery and php a. php extracts json data from the B. php file and displays it to the page div. how can this problem be written? & Nbsp; B. php Data is as follows & nbsp; $ arrarray (0 & gt; array (id & gt; 1, name & gt; zs, sex & gt; man), 1 & gt; ar jquery and php about json
A. php extracts json data from the B. php file and displays it to page p?

B. php Data is as follows:
$ Arr = array (
'0' => array ('id' => '1', 'name' => 'zs', 'sex' => 'Man '),
'1' => array ('id' => '2', 'name' => 'Ls', 'sex' => 'women '),
);
Echo json_encode ($ arr );
Return;

A. php file wants to retrieve json data and then cyclically display it to the page. The effect is similar to the following:
Id name
1 zs
2 ls
I just learned jquery recently, but I still don't know how to implement it? Thank you for your help.

------ Solution --------------------
Ajax? If not, directly include ('B. php'); operate on the array to output your structure.
------ Solution --------------------
This is a js issue. you should go to the javascript layout to solve it!

You $ ("p"). append ("

");
Isn't there a lot of IDs named aaaa?
However, the dhtml id must be unique.
------ Solution --------------------
Ajax contains the responseText attribute to obtain json data.

Then we can use jquery to display it on p.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.