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'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看