Xajax es un framework de ajax para php.
Es simplemente facil, uno declara una funcion y se la entrega un objeto xajax.
en php :
-
require_once("xajax.inc.php"); - Instancio el objecto xajax:
$xajax = new xajax();
- registro el nombre de la funcion php
$xajax->registerFunction("myFunction"); -
function myFunction($arg) { // do some stuff based on $arg like query data from a database and // put it into a variable like $newContent // Instantiate the xajaxResponse object $objResponse = new xajaxResponse(); // add a command to the response to assign the innerHTML attribute of // the element with id="SomeElementId" to whatever the new content is $objResponse->addAssign("SomeElementId","innerHTML", $newContent); //return the xajaxResponse object return $objResponse; } - Antes de enviar alguna salida manejo los requests:
$xajax->processRequests();
En html
- Entre <head></head> , ingreso el JavaScript necesario:
<?php $xajax->printJavascript(); ?>
- Llamo a la funcion de xajax desde javascript:
<div id="SomeElementId"></div> <button onclick="xajax_myFunction(SomeArgument);">
Se liberó una nueva versión de este OS, se actualizó el tema principal, y se agregó compatibilidad total con IE7.