Unable to Get a Correct Time when I am Calling serverTime using jquery.countdown.js + Asp.net ?
- by user312891
When i am calling the below function I unable to get a correct Answer. Both var Shortly and newTime having same time one coming from the client site other sync with server.
http://keith-wood.name/countdown.html
I am waiting from your response.
Thanks
$(function() {
        var shortly = new Date('April 9, 2010 20:38:10');
        var newTime = new Date('April 9, 2010 20:38:10');
            //for loop divid
            /// 
            $('#defaultCountdown').countdown({
                until: shortly, onExpiry: liftOff, onTick: watchCountdown, serverSync: serverTime
            });
            $('#div1').countdown({ until: newTime });
        });
        function serverTime() {
            var time = null;
            $.ajax({
                type: "POST",
                //Page Name (in which the method should be called) and method name
                url: "Default.aspx/GetTime",
                // If you want to pass parameter or data to server side function you can try line
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: "{}",
                async: false,
                //else If you don't want to pass any value to server side function leave the data to blank line below
                //data: "{}",  
                success: function(msg) {
                    //Got the response from server and render to the client
                    time = new Date(msg.d);
                    alert(time);
                },
                error: function(msg) {
                    time = new Date();
                    alert('1');
                }
            });
            return time;
        }