Determines if a call is a xajax request or a page load request.
Return:
boolean - True if this is a xajax request, false otherwise.
public canProcessRequest ( ) |
public function isAjaxCall() { static $bIsAjaxCall; // rest of code can be executed only one time if (!is_null($bIsAjaxCall)) { return $bIsAjaxCall; } if (!self::$oXajax->canProcessRequest()) { return $bIsAjaxCall = false; } self::$oXajax->processRequest(); return $bIsAjaxCall = true; }
<?php require_once "../xajax_core/xajax.inc.php"; $xajax = new xajax(); if ($xajax->canProcessRequest()) { echo ' '; } $xajax->configure('debug', true); $xajax->configure('responseType', 'XML'); $xajax->register(XAJAX_FUNCTION, 'showOutput'); $xajax->processRequest(); $xajax->configure('javascript URI', '../'); function showOutput() { $objResponse = new xajaxResponse(); $objResponse->alert("Hello"); return $objResponse; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>PHP Whitespace Test | xajax Tests</title> <?php $xajax->printJavascript("../"); ?> </head> <body>