Source for file helper_usage.php
Documentation is available at helper_usage.php
* Example of Using HTML_AJAX_Helper
* HTML_AJAX_Helper takes care of basic JavaScript and HTML generation that is needed in many AJAX requests
* @author Joshua Eichorn <josh@bluga.net>
* @copyright 2005 Joshua Eichorn
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version Release: 0.5.4
* @link http://pear.php.net/package/HTML_AJAX
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
$ajaxHelper->serverUrl = 'server.php?gzip=true';
$ajaxHelper->jsLibraries [] = 'customLib';
// output a javascript neded to setup HTML_AJAX
// by default this is all the libraries shipped with HTML_AJAX, take a look at $ajaxHelper->jsLibraries to edit the list
echo $ajaxHelper->setupAJAX ();
// output a custom loading message
echo $ajaxHelper->loadingMessage ("Waiting on the Server ...");
<div id="updateTarget">I'm an update Target</div>
// update the element using ajax
echo $ajaxHelper->updateElement ('updateTarget',array ('test','echo_string','Some text to echo'),'replace',true );
<p>Was this page loaded using AJAX: <?php var_dump($ajaxHelper->isAJAX ()); ?></p>
Below is the output of HTML_AJAX_Helper::isAJAX() on content loaded from AJAX
<div id="updateTarget2"></div>
echo $ajaxHelper->updateElement ('updateTarget2','support/isajax.php','replace',true );
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
Documentation generated on Fri, 04 Apr 2008 18:30:16 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|