<div dir="ltr">Hi guys,<div><br></div><div>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. </div><div><br></div><div>This works fine for normal requests as any &quot;interaction&quot; from the user with the app, will make a normal request causing a re-render of everything, included the notification component. </div><div><br></div><div>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. </div><div><br></div><div>I tried the following:</div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>html </div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>document </div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>addLoadScript: (html jQuery document</div><div>                     onAjaxComplete: (</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                        </span>  <span class="gmail-Apple-tab-span" style="white-space:pre">        </span>(html jQuery id: self  systemMessageNotifier mainDivId)  replaceWith: [:r |</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                        </span>self systemMessageNotifier renderContentOn: r.<span class="gmail-Apple-tab-span" style="white-space:pre">        </span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                                </span>]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                                                        </span>)).</div><div><br></div><div>But obviously that doesn&#39;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. </div><div><br></div><div>What I don&#39;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 ?</div><div><br></div><div>Thoughts?</div><div><br></div><div>Thanks in advance,  </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>-- <br><div class="gmail_signature">Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br></div>
</div></div>