[Seaside] Execute jQuery script upon #onAjaxComplete?

Esteban A. Maringolo emaringolo at gmail.com
Fri Sep 23 18:23:24 UTC 2016


2016-09-23 12:21 GMT-03:00 Mariano Martinez Peck <marianopeck at gmail.com>:
> 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.

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

> 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 ?

I don't understand what you want to implement.

If you want to notify something, then such notification should come as
a response of the xhr and implement the ajaxComplete function handler
to parse the response searching for the notification you want to
display.

The alternative is to include a <script> in every ajax response to
update the notification on the client side.

I also don't see how you using websockets would benefit you unless you
hook the socket to an announcer.

Regards,

--
Esteban


More information about the seaside mailing list