Dynamic Web Development with Seaside

21.3Adding jQuery

After creating a jQuery object on the Smalltalk side it is time to investigate on how to add them to the Seaside application.

The standard way of doing so in jQuery is to keep all the Javascript functionality unobtrusive in a separate Javascript file. This is possible with Seaside, but not the suggested way. In Seaside we try to encapsulate views and view-related functionality in components. Furthermore we keep components independent of each other and reusable in different contexts, what does not work well with sharing unobtrusive Javascript code. Additionally, the unobtrusiveness comes into the way when we want to define AJAX interactions.

Attaching to Element

html anchor
onClick: (html jQuery: 'div')
remove;
with: 'Remove DIVs'
html anchor
onClick: (html jQuery this)
remove;
with: 'Remove Myself'

Execute at Load-Time

  • Forget about $(document).ready(...)
  • Seaside has its own mechanism there
html document addLoadScript: (html jQuery: 'div') remove
§
jQuery
Ajax
Performing Actions
This is a draft chapter.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.