Asynchronous JavaScript and XML, or AJAX

October 22, 2005 – 9:34 am

Ajax Technology The more and more I work with AJAX, the more and more complicated things seem to get. Now this may be because it’s being used in a rather complicated system, or it may be more because the architecture behind the application is more complicated than the application needs to be.

When I think in terms of the amount of time it would take to develop a data entry and management system all in PHP, versus the time it would take to implement the method using OO javascript with xmlhttprequest objects and PHP, I wonder how much longer it really does take using AJAX. I just feel like there is something missing when using the xml request objects, some overhead that can’t be factored out right now.

The issue is not generating the request objects since that has very little work to be done after the initial classes are implemented. There are even some premade out there like specifically for PHP, which include:

Libraries with PHP Server Side Integration

  • HTML_Ajax PHP and JavaScript Ajax
  • XOAD (formerly NAJAX) PHP based AJAX/XAP object oriented framework.
  • xajax PHP Ajax toolkit
  • sajax Simple Ajax Toolkit by ModernMethod
  • pajax Pajax toolkit
  • flxajax Flexible Ajax (OOP available in PHP4 and PHP5 versions)

Now I haven’t tried any of these out of the box solutions yet, however I’m skeptical as to if they would cover any of the issues I am facing. The problems are:

  1. Handling form saving, form data fetching, and filling of forms across about 50 tables.
  2. The form fields that map to the given database fields are spread across mutilple pages — with mutiple pages having form fields that map to multiple tables.
  3. Many of the forms require a large amount of data — both the template to be loaded, and the data to be fetched, forcing mozilla to be rather slow. There are some options to speeding this up, however none of them are cut and dry.

There are of course other issues, but these are the main ones we’re facing right now.

We currently are using a javascript helper object for each table in the database. It takes care of knowing which of its form elements are loaded, knows how to fill them, and what server side function / object to call to save them (which includes validation, etc). The problem is there end up being 50 helpers, 5 to 6 which are being managed by another javascript object at one time. This can cause a bit of a slow down in the page time.

This doesn’t include the fact that all of the templates for the page are stored on the server. Yes they are cached after they are loaded, but some of them have a bit of size to them, so this affects the load time as well.

So I need to figure out the following:

  1. How to optimize the runtime — what applications are available for profiling a javascript application? I don’t know of any (although there is the venkman to use for debugging).
  2. On a more global level, if there is a better paradigm for doing large amounts of data entry across multiple tables.

Sorry, comments for this entry are closed at this time.