用动态javascript--server.php来处理数据,调用HTML_AJAX.replace('target', 'testdata.php')来替换id为target这个div的内容。
-
PEAR::Pager example with AJAX
-
-
-
"target">I'm the target
-
-
HTML_AJAX.replace('target', 'testdata.php');
-
-
-
这是个很简单的php程序,取到分页数据并输出html
-
-
require_once 'Pager/Pager.php';
-
$data = range(1, 100); //an array of data to paginate
-
$pager_params = array(
-
'mode' => 'Sliding',
-
'append' => false, //don't append the GET parameters to the url
-
'path' => '',
-
'fileName' => 'javascript:HTML_AJAX.replace(\'target\',\'testdata.php?pageID=%d\');', //Pager replaces "%d" with the page number...
-
'perPage' => 10, //show 10 items per page
-
'delta' => 1,
-
'itemData' => $data,
-
);
-
$pager = & Pager::factory($pager_params);
-
$n_pages = $pager->numPages();
-
$links = $pager->getLinks();
-
echo '
This container is loaded with an AJAX call
'; -
echo '
DateTime: '. date('Y-m-d H:i:s') .'
'; -
echo '
Page '
. $pager->getCurrentPageId() .''; -
foreach ($pager->getPageData() as $item) {
-
echo 'Item '. $item .'
'; -
}
-
echo '
'.$pager->links; -
?>
用HTML_AJAX_Server来处理ajax这些烦心事吧
-
-
include 'HTML/AJAX/Server.php';
-
-
$server = new HTML_AJAX_Server();
-
$server->handleRequest();
-
?>
web 2.0, Ajax的趋势图
时下的web 2.0和Ajax概念正是如火如荼,且不论Ajax这东东到底是不是炒作的产物,就实际应用来说,Ajax在某些场合的确是顶好用而且看上去挺酷.
蓝的是web 2.0,红的是Ajax
参考文档
作者: 发表于10月 23, 2006 at 7:53 am
: 可以任意, 转载时请务必以超链接形式标明文章和及此声明