Location: PHPKode > scripts > pAjax > pajax/tests/inline_call.php
<?php

require_once "../class.pAjax.php";


function foobar() { return "foo"; }


$AJAX = new pAjax;
$AJAX->disableDomainProtection();
$AJAX->enableExportProtection();
$AJAX->export("foobar");
$AJAX->handleRequest();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <title>Inline Ajax Call Example</title>
    <?php $AJAX->showJavaScript(".."); ?>
  </head>

  <body>
    <h1>Inline call test with no arguments</h1>
    <p>Call the function 'foobar' on server and get its response</p>
    <script type="text/javascript">
        var func = function (e) {
            // "e" is the content of pAjax.getResponse()
            alert(e);
        }
    </script>
    <input type="button" onclick="pAjaxCall(null, 'foobar', func)" value="Click me!" />
  </body>
</html>
Return current item: pAjax