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
相关文档:
PHP中提供四个函数实现对php.ini的操作:ini_get、ini_set、ini_get_all、ini_restore
其中最常用的是ini_set和ini_get。
下面具体来说说这两个函数的作用:
ini_get()
获取配置文件的选项值,即获取配置文件中某一个选项的值,如果是true值就返回1,如果是false值就返回0,字符串就返回字符串。
例如:
<?p ......
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
<mce:style type="text/css"& ......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0044)http://www.qqip.cn -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>new document</TITLE>
<META ht ......
来源:haoxuewu - BlogJava
前段时间做项目用到了json,今天我抽时间写了一个struts+ajax+json的例子.
个人感觉ajax+json在很大程度上降低了网络和服务器的IO,是一个很不错的组合!
1:json的lib我用的是json-lib-2.1-jdk15.jar,它可以在
2:struts用的是1.2
3:用到了js第三方prototype.js,主 ......
来源于:http://news.csdn.net/a/20100201/216819.html
CSDN报道
SDTimes高级编辑Alex Handy在博客
中爆料,上周Facebook邀请了PHP核心团队到公司讨论他们的新项目:从头重写的PHP运行库。周二他们将正式发布这个项目,并开源。
Handy相信,这是两年前Facebook招揽的一位PHP高手所为。
但也有网友在博客下留言说,Fac ......