Valentin Agachi

freelance web developer

request quote!

JPSpan 2.0

One of my favorite AJAX frameworks has been and still is, JPSpan. But as it is, it does have a few minuses, which I've managed to eliminate.

I've hacked away into the source of the JPSpan framework and added three new features: support for Opera 8.5+, JSON encoding for transfer and global Init and Complete event handlers.

JPSpan meets Opera

The original code for JPSpan for creating the XMLHttpRequest object did not support Opera, which is a downside. I've modified the code to support Opera from 8.5 upwards.

JSON encoding

The JS generated by the server end of JPSpan is too large in size. The same data could be sent with JSON in less than a third of size of the JS generated by JPSpan. Another minus I wanted to and did fix. JPSpan was build in mind for extensibility, and it was rather easy to integrate a new encoding format, which you've guessed it to be JSON.

Now both request and response data will be sent in JSON.

Global Init and Complete event handlers

If you've used JPSpan before you know how the calls are made and how the responses are handled. If not I'll describe it in a few words. Every call will be made through an object which will have to be created in association with a handler. Thus when calling method X, the response will trigger method X on the handler assigned to the calling object.

The problem is there was no kind of global Loading and Complete event support, for displaying visual feedback that an ajax call is currently happening such as a "Loading" area. Now this issue no longer exists. There is support for two method on the handler associated with the calling object. onInit, if defined, fires at the start of every call. And onComplete, fires after the results have been received.

 

To view a demo of these features just view this test page.

To download the files of JPSpan with these new features and the example also: jpspan-2.0.zip [59 Kb]

Comments

at 01:54 on 09/Jun/2006

Mark

Comment by Mark

Neat contribution, good name for it, will give it a try right now

at 23:49 on 21/Aug/2006

Hugh

Comment by Hugh

I think in the view of nowadays trend there is no need to meet opera...

at 14:26 on 09/Jul/2007

roger

Comment by roger

great library, but i have a problem, i can't get arguments by using func_get_args(), do u know if it can be a server configuration problem??

Who's this guy?

Hello! I am Valentin Agachi, an ambitious web developer, and you are viewing my site and weblog.

If you care to find more details about me, you can check out my CV page, or you can contact me.

Valentin Agachi's profile on LinkedIn Download vCard

About this entry

You are reading a post entitled "JPSpan 2.0".

It was posted on 20 May 2006 and tagged with Ajax, Bugs, PHP.

Technorati tags: Ajax Bugs PHP

Post this:

© 2003-2010 Valentin Agachi. All rights reserved.