I need your suggestion on something. I want to display a 'message notification' on my menu bar. I want it to be like the Facebook message notification. When I have a new message, '1' should show close to the message menu e.g. 'Message 1' (I can use CSS to style this). Then when I open the message menu and view the 'new message', the '1' should disappear and return to just 'message' on the menu bar. How do I achieve this? I don't know how to do this. Your help will be appreciated.

it is not really so simple and requires a bit of php and jquery knowledge to pull this off perfectly.

here is two way you can di this, one is to use a ajax call to look for changes in the database timely(maybe 10 second interval), but this make unnecessery calls to the server and it can cause heavy load. but for small site this should be fine.

a better way to do this is to use Comet. Facebook use this technology to display real time notification.


it is a bit complex, here is a great SO thread about it: