AJAX Libraries
|
|
|
|
| Articles Reviews Ajax | |
| Written by Phil Harrison | |
| Sunday, 15 October 2006 | |
|
{mos_sb_discuss:53} AJAX
SAJAX SAJAX
(http://www.modernmethod.com/sajax/) is the Simple AJAX Toolkit, and has a
server-side implementation in
PHP (among many other languages). Essentially, using this library, you can
define functions in PHP and
call them from the client via XMLHTTP request. To enable a given function for remote procedure
call requires only one SAJAX function call: sajax_export(`phpFunctionName').
Unfortunately, SAJAX does not help when it comes to the necessary DOM manipulations. In fact, because SAJAX treats the response as text and inserts the response directly into the document using the innerHTML property of a given element (which is often considered inferior to DOM manipulations), DOM manipulations are not possible unless you implement your own string parsing algorithm. On the SAJAX frequently
asked questions page (http://www.modernmethod.com/sajax/faq.phtml), the developers list
"Not overly abstract" as a feature. Many aspects of XMLHTTP
communication could benefit greatly from
abstraction, so you might consider SAJAX's lack thereof as a drawback. Still,
SAJAX offers a method of
simplifying the server-side handling
CPAINT
CPAINT
(http://cpaint.sourceforge.net/) is the Cross-Platform Asynchronous Interface
Toolkit. CPAINT generates the
XML for you from function calls, and the result is a somewhat non-semantic structure. Also, for
some unknown reason, the generated XML elements are all in uppercase. If the
name you supply for an
element is not in full uppercase, the library converts it to full uppercase.
The documentation of library
usage is a little tough to get through, but each part of the puzzle is
explained well and a trivial example
is given for each to help you grasp the idea.
JPSPAN
The primary goal of
JPSPAN (http://jpspan.sourceforge.net) is to bridge the gap between JavaScript and PHP.
It allows for seamless importing of PHP classes to JavaScript. This means that
you can define a class in PHP
and call its methods as if it were a native JavaScript object. Behind the
scenes, JPSPAN is issuing requests
to the server to execute methods remotely. Other libraries offer similar
functionality, but they do not come
close to the abstraction offered by JPSPAN. Documentation and example code for JPSPAN are abundant
and clear. Both are in wiki format and are thus ever-growing. The code itself
is clean and easy to read,
just like the XML it generates. Furthermore, initial work is currently under
development to embed JPSPAN in
PHP frameworks to make it even easier to develop fat-client applications.
The library does not offer relief from DOM manipulation tasks, but it does abstract the usage of XML-HTTP quite well. Unfortunately, it seems to have problems supporting Opera, but it supports Mozilla-based browsers and Microsoft's IE quite well. Additionally, depending on your application, a bridge between JavaScript and PHP might not do you a lot of good, and only serve to exchange XML tree traversal with object and native JavaScript accesses. As there is additional overhead involved in
creating the native JavaScript
versions of PHP classes, the benefits might not outweigh the costs. However, because of the
excellent use of abstraction, JPSPAN could allow you to almost completely
ignore the details of how PHP
classes are being made available to JavaScript and focus attention on the
functionality of the
application itself.
There are many other
Powered by jReviews |
|
| Last Updated ( Saturday, 07 July 2007 ) | |
| < Prev | Next > |
|---|







