tags:

views:

77

answers:

2

Hi, I'm writing a simple chat module that will be embedded in a website. It will allow website visitors to chat with the website owner.

The website is ruby/rails and I'm using AJAX.

One thing I can't figure out how to do is how to play a 'bling' sound when a new message arrives (don't worry, this sound is switchable, and the default is 'off'.)

I want the "bling" to play when the message arrives... i.e., when the div that holds the message list is updated by the Server via Ajax.

I'm thinking I need an Event.observe('myDiv', someEvent, callback) function, but I can't figure out what I should use for 'someEvent'...

Any help, much appreciated.

-- John

A: 

See this post.

RichardOD
A: 

have you tried 'load' or 'change'? for listeners the event has to be of a certain type described here http://www.w3.org/TR/DOM-Level-2-Events/events.html

another option would be to attach the sound to the AJAX callback function which populates the div.

hope that helps, Josh

Josh