Пример #1
0
    $objArgumentManager =& xajaxArgumentManager::getInstance();
    $aArgs = $objArgumentManager->process();
    $objResponse = new xajaxResponse();
    $objResponse->alert("This is from the invalid request handler");
    return test2ndFunction($aArgs[0], $objResponse);
}
function testForm($formData)
{
    $objResponse = new xajaxResponse();
    $objResponse->alert("This is from the regular function");
    return test2ndFunction($formData, $objResponse);
}
$xajax = new xajax();
$xajax->configure('javascript URI', '../');
$xajax->setFlag("errorHandler", true);
$xajax->registerEvent(XAJAX_PROCESSING_EVENT_INVALID, "onInvalidRequest");
if (isset($_GET['registerFunction'])) {
    if (1 == $_GET['registerFunction']) {
        $xajax->registerFunction("testForm");
    }
}
$xajax->processRequest();
?>
<!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>onMissingFunction Event (used to be catch-all) Function Test | xajax Tests</title>
<?php 
$xajax->printJavascript();
?>
Пример #2
0
            $get = print_r($_GET, true);
            $post = print_r($_POST, true);
            $objResponse->alert($this->message . ', which will now allow the request to continue:' . "\n" . $get . $post);
            return $objResponse;
        }
        $bEndRequest = true;
        $objResponse->alert($this->message . ", which will now end the request.");
        return $objResponse;
    }
}
$xajax = new xajax();
//$xajax->setFlag("debug", true);
if (isset($_GET['useObjects'])) {
    if ('true' == $_GET['useObjects']) {
        $preObj = new myPreObject();
        $xajax->registerEvent(XAJAX_PROCESSING_EVENT_BEFORE, array(&$preObj, "beforeProcessing"));
    }
} else {
    $xajax->registerEvent(XAJAX_PROCESSING_EVENT_BEFORE, "beforeProcessing");
}
$xajax->registerFunction("testRegularFunction");
$xajax->processRequest();
?>
<!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>beforeProcessing Event (used to be pre-function) Test | xajax Tests</title>
<?php 
$xajax->printJavascript("../");
?>