Execute jQuery script upon #onAjaxComplete?

Mariano Martinez Peck <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <CAA+-=mXZTj2sJvEV2PSSXL8ap8QdYThbfXjeUoV4w+oBZHayqA@mail.gmail.com>
Hi guys,

I am trying to make some alerts/notifications to be displayed to users. For
some internal reasons, these notifications are at server side. I have main
component that on the #renderContentOn: does the render of the needed
notifications.

This works fine for normal requests as any "interaction" from the user with
the app, will make a normal request causing a re-render of everything,
included the notification component.

The problem, as usual, is all ajax requests (and my app is now almost
everything with ajax). I need to hook on ajax calls so that I could also
re-render the notifications components as there could have been new
notifications since the last rendering.

I tried the following:

html
document
addLoadScript: (html jQuery document
                     onAjaxComplete: (
  (html jQuery id: self  systemMessageNotifier mainDivId)  replaceWith: [:r
|
self systemMessageNotifier renderContentOn: r.
]
)).

But obviously that doesn't work because the onAjaxComplete: scripts ends
being a hardcoded to the html of the current systemMessageNotifier
component. In other words, the #renderContentOn: of the
systemMessageNotifier is called only once...and not on every ajax complete.
And I understand why.

What I don't know how to do is what I want hahhaa. I would try to avoid
WebSockets for the moment. I thought maybe doing some jQuery polling ?

Thoughts?

Thanks in advance,





-- 
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.