-
Notifications
You must be signed in to change notification settings - Fork 71
Ajaxification
The Ajaxification script replaces full page request with AJAX requests and replace the entire document body. The script registers a click handler on the body of the DOM tree. It checks if the clicked element is an anchor or within one. Then the anchor node is asked for its URL element.href and an Ajax request is instantiated. The last step of the event handler stops the event processing, so that the default action of the web browser is vetoed. Finally the handler extracts the body and head from the response and injects it into the current DOM tree.
That’s all that is needed to turn any Seaside application into a full blown Ajax application. People might argue that we are cheating here: we are still doing a full request, we just do it asynchronously in the background using XMLHttpRequest
. This gives only a marginal speed improvement (the same amount of data is transfered), but looks much smoother than doing a full request. For example, the page does not scroll to the top and is replaced without the usual flickering a full request does. Best of it, the script works well, even if you have other manually crafted Ajax actions in your code. Furthermore it supports the use of #call:
and #answer:
, something that was not easily possible before.
The script preserves the ability to use the back button of the web browser by using window.history.pushState
.
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.
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.
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.
For the original documentation see:
Changelogs
- (newer changelogs, see https://github.com/SeasideSt/Seaside/releases)
- 3.4.0
- 3.3.0
- 3.2.4
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.11
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 2.8
- 2.7
- Past Releases
Development
Documentation
- Configuration and Preferences
- Embedding Subcomponents
- Maintaining State
- Generating HTML
- CSS and Javascript
- Debugging Seaside Applications
- Links, Forms and Callbacks
- Development Tools
- Call and Answer
- Naming URLs
- Security Features
- Securing Seaside Applications
- Seaside-REST
- Add-On Libraries
- Persistence
- Gettext
- FileLibrary
- The Render Tree
- PDF Generation
- Long-Term Issues
- Ajaxification
- Web Components
- Big Issues
Sprints