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.