doujia1904 2016-10-14 10:33
浏览 50
已采纳

如何使用触发器打开html页面

i am using database trigger

when database row updated i want to get real time notification like change happened now

suppose i am using message table in my database

suppose user inserted value in message table. i want change should be noted using

trigger at real time and then i want open an html page when row inserted in my

message table then html page should open or an alert box show notification

that"you received a new message".

Please help me to solve this problem for example CREATE TRIGGER notifyMe

ON table1

AFTER INSERT, UPDATE, DELETE 

  AS
  EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'DB AutoMailer',

    @recipients = 'user@example.com',

    @body = 'The DB has changed',

    @subject = 'DB Change';

 in above example mail is sending but i want to open html page i need syntax   to open html page
  • 写回答

1条回答 默认 最新

  • douyin2883 2016-10-14 13:32
    关注

    Well below is a example of what you need exactly:

    javascript

        var old_count = 0;
    
    setInterval(function(){    
        $.ajax({
            type : "POST",
            url : "file.php",
            success : function(data){
                if (data > old_count) {
                    alert('new record on i_case');
                    old_count = data;
                }
            }
        });
    },1000);
    

    then php

    $sql = "SELECT count(*) as count FROM i_case";
    $qry = pg_query($connection, $sql);
    $row = pg_fetch_assoc($qry);
    echo $row['count'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM