Friday, February 27, 2015

REMAINDER SCHEDULAR ALERT USING JQUERY TIMER

Add the following jquery files 

You need to  download the following files

  <link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>

    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

    <script src="jquery.timers.js"></script>
    
    <script type="text/javascript">

        $(document).everyTime(10000, function (i) {
            $.ajax({
                type: "POST",
                url: "popup.aspx/GetUserInfoData",
                data: '{}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                failure: function (response) {
                    alert("Failure Details : " + response.d);
                },
                error: function (response) {
                    alert("Error Details: " + response.d);
                }
            });
        });
        function OnSuccess(response) {
            var xmlDoc = $.parseXML(response.d);
            var xml = $(xmlDoc);
            var users = xml.find("Table");
            if (users.length >= 1) {
                $("#div1").dialog({
                    title: "Hi Welcome",
                    width: 600,
                    height: 400,
                    modal: true,
                    buttons: {
                        Close: function() {
                            $(this).dialog('close');
                        }
                    }
                });
            }
        }

    </script>









Design:


<body>
    <form id="form1" runat="server">
        <div>
            <div id="div1" style="display: none">
                <b>Welcome to this World</b>
            </div>
        </div>
    </form>

</body>


protected void Page_Load(object sender, EventArgs e)
    {

    }

    [WebMethod]
    public static string GetUserInfoData()
    {

        SqlConnection con = new SqlConnection("    ");
        SqlCommand cmd = new SqlCommand("select * from fdfd", con);
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(ds);
        return ds.GetXml();

    }






Output:

Wait for 15 seconds, then the pop up will be displayed automatically.




No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...