Json pop-up

A piece of ajax-type javascript which polls the server every 20 seconds. If the server sends back a message, that message is to pop-up in a notification box.
I’ll do the server side which will just send back a message in JSON format to your script if there is a new alert for the user. For example, the following message might be sent back from the server:
{‘message’: ‘New trading signal: Buy Eur/Usd at 1.2345, Stop loss: 1.2314, Target 1: 1.2390’}

If there is no message to display, then the result that comes back from the server will just be: {}

Once you pop-up a notification box, it will remain displayed until the user clicks the ‘x’ to close it . If another message comes through from the server while the previous pop-up is still open, I’d like the new message to just replace the old message in the same pop-up.

That part i want to do how can i do it?

FWIW, yours seems to be a mostly client-side question, how to handle this in Javascript.

jQuery has plenty of add-ons which help you achieve this, no doubt other js libs have similar, many of them emulate something on Macs called “growler” - I think.

Stay away from pop up windows, as you also then face problems with the popup “losing focus” and popping under the current window, hanging around after the current window is closed etc.

The growler-type solutions use a div on the page which seems to be a lot easier to manage, especially if you have already invested in loading a js lib such as jQuery.

HTH