function smarty_function_ajaxcall($params, &$smarty) { require_once 'HTML/AJAX/Helper.php'; $target = @$params['target']; $call = @$params['call']; $type = !is_null(@$params['type']) ? @$params['type'] : 'replace'; $ajaxHelper = new HTML_AJAX_Helper(); $ajaxHelper->serverUrl = '/AJAX/server.php'; if (@isset($params['stubs'])) { $stubs = split(',', $params['stubs']); foreach ($stubs as $stub) { $ajaxHelper->stubs[] = $stub; } } if (@(!$smarty->hasJSlibs)) { echo $ajaxHelper->setupAJAX(); } $smarty->hasJSlibs = true; if (@is_null($params['loadJS'])) { // echo $ajaxHelper->loadingMessage ( "Waiting on the Server ...", null, 'position: absolute; top: 0; left: 0; display: none;' ); echo $ajaxHelper->updateElement($params['target'], $params['call'], $type, true); echo '<div id="' . $target . '"> </div>'; } }
* @version Release: @package_version@ * @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 = new HTML_AJAX_Helper(); $ajaxHelper->serverUrl = 'auto_server.php'; $ajaxHelper->jsLibraries[] = array('haserializer'); $ajaxHelper->stubs[] = 'testHaa'; ?> <html> <head> <?php echo $ajaxHelper->setupAJAX(); ?> <script type="text/javascript"> var remote = new testHaa(); </script> <style type="text/css"> .test { color: red; } </style> </head> <body> <div id="test">
<?php require_once 'HTML/AJAX/Helper.php'; $objAjaxHelper = new HTML_AJAX_Helper(); $objAjaxHelper->serverUrl = './php/auto_server.php'; $objAjaxHelper->jsLibraries[] = 'haserializer'; $objAjaxHelper->stubs[] = 'login'; $strAjaxScript = $objAjaxHelper->setupAJAX(); ?> <html> <head> <title>Form validation (v2) with HTML_AJAX</title> <!-- HTML_AJAX --> <?php echo $strAjaxScript; ?> <script type="text/javascript"> /** * Basic page initialization */ function initPage() { // Set up the labels so they know the associated input elements var arrLabels = document.getElementsByTagName("label"); for (var i=0; i < arrLabels.length; i++) { var objTemp = arrLabels[i]; var strFor = objTemp.getAttribute('for'); // Fix the attributes if (strFor != '') { // Set the ID of the label objTemp.setAttribute('id', 'l' + strFor);