Source for file php_callback.php
Documentation is available at php_callback.php
require_once 'HTML/AJAX/Server.php';
// register normal function
$server->registerPhpCallback ($callback);
// register static method
$callback = array ('Foo', 'bar');
$server->registerPhpCallback ($callback);
// register object method
$callback = array ($foo, 'bar');
$server->registerPhpCallback ($callback);
if ($server->handleRequest ()) {
<script type='text/javascript' src="?client=all&stub=all"></script>
<script type="text/javascript" language="Javascript">
HTML_AJAX.defaultServerUrl = 'php_callback.php';
function testCallPhpCallback(cb)
HTML_AJAX.callPhpCallback(cb, showResult);
function showResult(result)
using HTML_AJAX.callPhpCallback()
<li><a href="javascript:testCallPhpCallback('foobar')">normal function</a></li>
<li><a href="javascript:testCallPhpCallback(['Foo', 'bar'])">static method</a></li>
<li><a href="javascript:testCallPhpCallback([foo, 'bar'])">object method</a></li>
<li><a href="javascript:alert(foo.bar())">object method</a></li>
Documentation generated on Mon, 11 Mar 2019 15:59:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|