xajax is easy! Just include xajax, register
a function (or an object or class method)...


<?php
include './xajax/xajax_core/xajax.inc.php';

$xajax = new xajax();

$rqstAdd =& $xajax->register(XAJAX_FUNCTION, 'doAdd');
$rqstReset =& $xajax->register(XAJAX_FUNCTION, 'doReset');

// set the parameters
$rqstAdd->setParameter(0, XAJAX_JS_VALUE, 39);
$rqstAdd->setParameter(1, XAJAX_JS_VALUE, 571);

$xajax->processRequest();

function doAdd($a, $b)
{
    $response = new xajaxResponse();
    $response->assign('answer', 'innerHTML', $a + $b);
    $response->assign('reset', 'style.display', 'block');
    return $response;
}

function doReset()
{
    $response = new xajaxResponse();
    $response->clear('answer', 'innerHTML');
    $response->assign('reset', 'style.display', 'none');
    return $response;
}
then add a call to the function in your HTML or javascript...


<form action="#" method="post">
<input type="button" onclick="<?php $rqstAdd->printScript(); ?>" id="btnAdd" value="Click Me" />
<input type="button" onclick="<?php $rqstReset->printScript(); ?>" id="btnReset" value="Reset" />
<p id="answer"></p>
</form>
then see the result in the browser instantly!

Try it now:
Want to learn more about xajax?
See the tutorial...



Latest Development Blog Posts

Xajax 0.6 beta1

We are happy to announce the Beta1 release of Xajax 0.6. This releases focusses primarily on PHP 5.3 compatibility and performance improvements. We removed all legacy functions and classes from Xajax 0.5 and added JSON support for requests as well as responses.

Read more | 0 Comments »


Xajax 0.2.x support is going to end on 2010/09/01

Hello everyone,

I'm going to discontinue the xajax 0.2 support on 2010/09/01, which mean's the according forum section is gonna be closed. At the same time I'm gonna open a new 0.6 section - yep, you read it right! :)

Read more | 0 Comments »




XAJAX on SourceForge.net
Support this project Valid XHTML 1.0 Transitional