JQuery uses ajax to request php to traverse the code in the json array to the table (recommended), jqueryjson
Htmlcode (test.html), js at the bottom of html
The Code is as follows:
<! DOCTYPE html>
Php code (test. php)
<? Phpheader ("Content-Type: application/json; charset = UTF-8"); if ($ _ REQUEST ['getfunction']) {getList ();} function getList () {$ data = array ('id' => 1, 'name' => 'xiaoming', 'sex' => 'male ', 'time' => '2014 14:45:46 '), array ('id' => 2, 'name' => 'zhang', 'sex' => 'male ', 'time' => '2014 14:45:46 '), array ('id' => 3, 'name' => 'fishing king', 'sex' => 'male ', 'time' => '2014 14:45:46 '); $ list = json_encode (array ('LIST' => $ data); print_r ($ list ); // print_r (json_encode (array ('LIST' => $ data = array ())));}
The above section describes jQuery's code (recommended) that uses ajax to request php to traverse the json array into the table. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!