Beginning to Xajax

27 Aug 2009

Xajax is mainly used to develop ajax application easily with php.
To start with xajax first we want to download the latest xajax.(ie.,xajax 0.5)
you can download it from here

the steps are
1.include the in the php file.

2.Create an object for xajax class.
      $x1=new xajax();

3.Register the function we want to call.
           //the function be any thing you like . but it should be according to php rules.

4. write the function.
      function getdetails(){
          //code to be executed
         $res= new xajaxResponse();
                //this step is to create a new xajax response object.this line should not  be omitted.
        $res->assign("div1","innerHTML","text to be displied");
             //assign function is for xajax 0.5 the function for older version is addAssign() with same                             parameters.
            //the first parameter is the element id where the message to be displayed.
            //The second parameter is the attribute of the object specified in parameter1.
            //The third is the text to be displied. It can be even a php variable.
        return $res;                                       

5.Specify the request handler
           //this is specifically for  xajax 0.5
            //processRequests() is the function used in older versions

6.You wan to tell xajax to generate the javascript for it. The javascript  should be between head specify the following code between head tags.

7.Call the function from the html control
      eg:<input type="text" onblur="xajax_getdetails()"/>

You can even pass arguments for the function.
good luck
If you particularly enjoy my work, I appreciate donations given with Gittip.