There and Back Again

HTML_AJAX

If your on the pear-dev mailing list you should have already seen the post but i’ll blog about it here as well hoping to get some feedback.

A proposal was made on pepr for an HTML_AJAX library in PEAR. I was less then happy with the implementation and since once a package is in PEAR its hard to replace I thought i’d step up and provide a package that I think is ready for widespread use. I wasn’t really considering doing this before this came up, since its a lot of work, and JPSpan has been working fine for me (thats not to say I wouldn’t do some things differently). So here is an alpha release of my HTML_AJAX library.

Anyhow im actively looking for someone to come aboard as a co-maintainer of this package, if your interested let me know.

Its goal is to over OO javascript proxy and proxyless operation. Sync and Async AJAX calls, with an optional JS library offering things like a content replacement api. It should be usable in a server style setup (JPSpan) or directly in a page (Sajax). Its curently doing all communication using JSON, but that might change if someone sees a good reason.

The current feature set is:

  • Ability to register multiple classes on one page
  • JSON is used for communication in both directions (I made add JPSpan xml from JavaScript to server as well)
  • Class are exposed to Javascript as classes
  • POST is used for sending requests
  • Decent JavaScript error handling (right now there is an alert catch on the errors, but we might just leave the exceptions alone at some point)

Next Steps are:
In the Javascript code:

  • Decide if JavaScript JSON implementation has a license that is ok (json.js)
  • At least switch to a smushed json.js (3k instead of 10k)
  • Clean up HTML_AJAX.js, I pull in a bunch of classes from JPSpan and I think they can be made smaller through refactoring
  • Expose onLoad etc events
  • Complete Async Callback support
  • Create an addon api that allows for, proxyless operation, direct content replacement from results

In the PHP Code:

  • Pearify JSON.php (this currently has a pepr proposal in the draft state, the author said he will try to move it forward, but who knows if he will have time)
  • Complete the api so it that is supports inpage operation like test.php, or out of pager operation (including the javascript proxy files)
  • Write code to deliver the js files through php with the proper caching headers, so you don’t have to copy the js files around unless you want too
  • Write a cache for javascript proxy files (I did this for JPSpan today so it should be too hard)

2 thoughts on “HTML_AJAX

  1. E2

    HTML_AJAX is wonderful, but I am sorry because HTML_AJAX doesn’t support multi-byte string.
    Will multi-byte string be able to be supported?

  2. Joshua Eichorn Post author

    Multi-byte strings aren’t on the short term feature list, but if you have an example i’ll work on it as I have time.