Forum: Ruby on Rails Javascript Event Handler for Chat App

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5c26728d2db67a78f9097f63ed3c8d37?d=identicon&s=25 Bing Tan (sombrero)
on 2006-05-04 20:16
Hi guys,

I'm stuck with this perplexing problem of Javascript and periodic
updater. I'm trying to do a chat application and it's an issue of
holding on the the div id. I have no problems when the user clicks on a
submit button to sends a message to the presence server. On the other
side of it though, I'm using periodicupdater to poll the server for the
messages to act as the listener, the problem is that bec I can't hold on
to the div id, the messages being retrieved from the presence server are
being broadcasted to all of the divs.

I know that the only way to capture the div id is if an event was
triggered. So to try and solve the problem of the listener, I had
thought of creating the listener into a form where a "hidden button"
will actually be triggered periodically. Holding on to the button allows
me to hold on to the div element. But with this solution, is there a way
for me to periodically update that button? How would I create my
periodic update if my server listener app was a form and my event was a
hidden button...or is there a way to do this aside from using an
invisible button?

any help would be very much appreciated!

thanks,

Bing
5c26728d2db67a78f9097f63ed3c8d37?d=identicon&s=25 Bing Tan (sombrero)
on 2006-05-05 04:56
anyone?

 Hi guys,

 I'm stuck with this perplexing problem of Javascript and periodic
 updater. I'm trying to do a chat application and it's an issue of
 holding on the the div id. I have no problems when the user clicks on a
 submit button to sends a message to the presence server. On the other
 side of it though, I'm using periodicupdater to poll the server for the
 messages to act as the listener, the problem is that bec I can't hold
on
 to the div id, the messages being retrieved from the presence server
are
 being broadcasted to all of the divs.

 I know that the only way to capture the div id is if an event was
 triggered. So to try and solve the problem of the listener, I had
 thought of creating the listener into a form where a "hidden button"
 will actually be triggered periodically. Holding on to the button
allows
 me to hold on to the div element. But with this solution, is there a
way
 for me to periodically update that button? How would I create my
 periodic update if my server listener app was a form and my event was a
 hidden button...or is there a way to do this aside from using an
 invisible button?

 any help would be very much appreciated!

 thanks,

 Bing
This topic is locked and can not be replied to.