What is XOAD (PHP and Ajax)?XOAD,an acronym for XMLHTTP Object-oriented Application Development., is a server-side Ajax toolkit written in PHP.
XOAD Features:- it uses JSON and native PHP serialized objects to communicate,
- special attention has been paid to security,
- supports server side events ,
- client side events ,
- server and client extensions,
- HTML manipulation ,
- Caching .
Downloading and Installing XOADLatest Version is 0.6.0.0, you can download from here Create a sample XOAD applicationThe aim of this example is to calculate the length of a string and dispaly it Create a myClass.class.php<?php class myClass { function stLength($mystring) { return strlen($mystring); } function xoadGetMeta() { XOAD_Client::mapMethods($this, array('stLength')); XOAD_Client::publicMethods($this, array('stLength')); } } ?> Note: stLength() merely returns the length of a string variable Below shows the XOAD application <?php require_once('myClass.class.php'); require_once('xoad.php'); XOAD_Server::allowClasses('myClass'); if (XOAD_Server::runServer()) { exit; } ?> <?= XOAD_Utilities::header('.') ?> <script type="text/javascript"> var myobj = <?= XOAD_Client::register(new myClass()) ?>; var mystring = 'Hello World! (XOAD Application)'; myobj.onStLengthError = function(error) { alert(error.message); return true; } myobj.stLength(mystring, function(result) { document.write('String: ' + mystring + '<br />Length: ' + result); }); </script> Conclusion:it demonstrates the concept of methods from server-side PHP classes being made available on the client side as JavaScript objects. Reference:SAMS Teach Yourself Ajax in 10 Minutes Related Tutorials |