开发者

Show reminder as floating popup/alert

I need to show a reminder as floating popup/alert in my asp.net mvc (C#) application.

When the user has开发者_运维知识库 any information from the admin that should be notified at particular time, i need to show it as floating popup/alert in the user's screen.

For ex.: When the admin sets an alert "Payment due last date is 15-Oct-2009" to notify the user on "12-Oct-2009 10:00 AM". Then it should show the alert to the user on "12-Oct-2009 10:00 AM" as "Payment due last date is 15-Oct-2009".

Is there any simple way to do this?


Well don't know how simple is it, but you could use the JQuery Timer plugin, to start a timer that is going to run once in a while and make an ajax call to check if there is an alert that user need to be informed about.

So when admin sets the payment I would just submit it in the database. The function to which you are going to make an ajax call will check if there is any payment that reached the alert datetime. That function can return a JSON object with all needed information to show in the popup.

$(document).everyTime(10000, function(i) {

$.ajax({
    type: "POST",
    url: "controller/CheckTimerAction",
    dataType:"json",
    error: function(xhr, status, error) { },
    success: function(response) {

        if (response.AlertExist) {
            var dialog = $('#dialog');

            dialog.html(response.AlertInfo);
            dialog.dialog('option', 'width', '50%');
            dialog.dialog('open');
        }
    }
});});

There is the Dialog jquery plugin that can help you to show modal popup dialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜