Parsing JSON Data from PHP Using jQuery (ajax)
have been studying parsing JSON from PHP using AJAX to display it in
the client side and jQuery had been a great help to me. Here is a very
simple code in parsing JSON using jQuery that i made.
tablejsondata.php
This file makes the request to a php file and displays the returned data into a table.
<html>
<head>
<title>Parsing JSON from PHP Using jQuery</title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript">
</script>
</head>
<body>
<a href="#" id="loaduserdata">User Data</a>
<table id="userdata" border="1">
<thead>
<th>First Name</th>
<th>Last Name</th>
<th>Email Address</th>
<th>City</th>
</thead>
<tbody></tbody>
</table>
<script>
$(document).ready(function(){
});
$("#loaduserdata").click(function(){
$("#userdata tbody").html("");
$.getJSON(
"jsondata
.php
",
function(data){
$.each(data.userdata, function(i,user){
var tblRow =
"<tr>"
+"<td>"+user.first+"</td>"
+"<td>"+user.last+"</td>"
+"<td>"+user.email+"</td>"
+"<td>"+user.city+"</td>"
+"</tr>"
$(tblRow).appendTo("#userdata tbody");
});
}
);
});
</script>
</body>
</html>
jsondata.php
This is the file that contains the JSON data.
<?php
$json = '{
"userdata": [
{
"first":"Ciaran",
"last":"Huber",
"email":"elementum.purus@utdolordapibus.edu",
"city":"Mayagüez"
},
{
"fi
Ïà¹ØÎĵµ£º
ÕâÀïҲǿÁÒÍÆ¼öYII¿ò¼Ü£¬Õâ¸öÄêÇáµÄ¿ò¼ÜÓÉÃÀ¹ú»ªÈË¿ª·¢£¬Ãû½ÐѦǿ¡£Yii FramworkÊÇ2009×î¼ÑPHP¿ò¼Ü¡£
Yii ÊÇÒ»¸ö»ùÓÚ×é¼þ¡¢ÓÃÓÚ¿ª·¢´óÐÍ Web Ó¦ÓõĸßÐÔÄÜ PHP ¿ò¼Ü¡£Ëü½« Web ±à³ÌÖеĿÉÖØÓÃÐÔ·¢»Óµ½¼«Ö£¬Äܹ»ÏÔÖø¼ÓËÙ¿ª·¢½ø³Ì¡£Yii£¨¶Á×÷“Ò×”£©´ú±í¼òµ¥(easy)¡¢¸ßЧ( ......
³õѧJQUERY AJAXʹÓ㬲»ÖªµÀÔõôʵÏÖ£¬ÕÒÁ˰ëÌì×ÊÁ϶¼²î²»¶à£¬¿ÉÊǷŵ½ÎÒµÄÒ³ÃæÀï¾ÍÊDz»·µ»ØÖµ£¬ºóÀ´·¢ÏÖÒòΪûÍùºóÌ¨Ò³Ãæ´«ÖµµÄÔÒò£¬¼ÓÁË data: "name=John&location=Boston"¾ÍºÃÓÃÁË£¬ÕâÀïdata:""¿ÉΪÈÎÒâÖµ£¬ºǫ́²¢Ã»ÓнÓÊÕ¡£
ÏÂÃæÊÇÀý×Ó£¬ÊµÏÖµÄÊÇ»ñÈ¡·þÎñÆ÷ʱ¼ä²¢¸üÐÂ
ǰ̨´úÂ룺
function getServerTi ......
Perl¡¢PHP¡¢ASP¡¢JSP¼¼Êõ±È½Ï
±¾ÎĽ«¶ÔĿǰ×î³£ÓõÄËÄÖÖ¶¯Ì¬ÍøÒ³ÓïÑÔPerl£¨Practical Extraction and Report Language£©¡¢PHP£¨Hypertext Preprocessor£©¡¢ASP£¨Active Server Pages£©¡¢JSP£¨JavaServer Pages£©½øÐÐһЩ¼¼ÊõÐԵıȽϡ£
¡¡¡¡Perl
¡¡¡¡Perl£¨Practical Extraction and Report Language£©ÊÇÒ»ÖֺܹÅÀϵĽű ......
http://topic.csdn.net/t/20040927/15/3412922.html
http://www.docin.com/p-23414672.html
http://www.qqread.com/php/n652282101.html
http://www.51testing.com/?uid-65519-action-viewspace-itemid-142987
1 apacheÅäÖÃÎļþhttpd.conf×îááÌí¼Ó:
LoadModule php6_module "c:/php6/php6apac ......