Seaside Ajaxification FAQ

Some questions and answers that got raised with my recent post on Seaside Ajaxification:

Is this in use and tested?
Yes. I’ve written several industrial applications that use this trick to some extent for many years already. The code given in the blog post has been simplified to demonstrate the idea. Depending on the context used, it will certainly be required to consider additional things such as HTML forms or the back button.
Does it work with Seaside 2.8 and 3.0?
The trick does not depend on the web framework. In fact, it is possible to plug it into any web-application or web-site as it is.
Do I have to change my application when using the script?
No. When using the script you don’t have to think about AJAX at all. You write a traditional web application and it gets AJAX enabled simply by adding the script. There is no need to change existing code.
If an application has a large amount of almost-full-page AJAX re-draws, will the use of the script make this simpler?
Yes, the script centralizes and automatizes these re-draws.
Do I have to remove manually crafted Ajax actions?
No, the script assigns a click handler to the body of the document only. This means it is only triggered when the user clicks on a traditional link. Other click handlers in the document continue to work as is.
That back button comment sounds just too intriguing. Is it really that easy?
The idea is to put the _k part of the Seaside URL into the fragment of the URL.
Is there any way to force some actions to actually do a traditional full-page refresh?
Yes, by assigning an URL to window.location, or by changing the script to ignore certain anchors.
Will this cause callbacks to continuously accumulate on the server side until an actual full-page refresh?
No. To Seaside the AJAX requests look like normal full-page requests. Therefore Seaside behaves and caches the callbacks as it does with a traditional application.
Any plans to include any of these into Seaside 3.0 as some kind of extension package?
Yes, an improved implementation is part of the JQuery-Core package in Seaside 3.0. Just add the libraries JQDeploymentLibrary and JQAjaxifierLibrary to give it a try.
Posted by Lukas Renggli at 8 December 2008, 8:42 pm with tags seaside, javascript link


This is really very useful! If a page currently includes forms, would that break? What kind of changes might be needed?

Posted by Bob at 13 December 2008, 12:11 am link

Forms do not break the script, the published script just ignores them and causes a full request on submit. What you could do is to capture the submit event on the body of the document and serialize and post the form using AJAX, similar to what is done with the click event.

Posted by Lukas Renggli at 13 December 2008, 9:41 am link