Calling ServerSide Method using Jquery in .Net1.1
<p>I am using .net1.1 and trying to call a server side method using Jquery on click of browser Close button.My code is not working.I am posting my code below.Will anybody Guide me where did i go wrong?</p>

<pre><code>&lt;body MS_POSITIONING="GridLayout" onbeforeunload="javascript:return test()" &gt;

Ceci est une page cachée. Elle est utilisée pour la gestion du multi-fenétrage.

&lt;/body&gt;


    function test()
    {
       debugger;
       $(document).ready(function() {
        $.ajax({
        type: "POST",
        url: "HiddenPage.aspx/GetServerTime",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            alert("success"); 
        },
        error: function(msg) {
        alert("Error! Try again..."); 
         }
            });


                return false;           
                        })

        }
</code></pre>

<p>In Code behind</p>

<p>==================</p>

<pre><code>[WebMethod()]


public DateTime GetServerTime()
{


return DateTime.Now;
}
</code></pre>

<p>}</p>

<p>The control does not go to this web method,I am not able to debug,COntrol goes to '   $(document).ready(function() ' after that whole block runs.It is not showing any type of error,but alerts are not showing.If I use any other return type instead of DateTime,It is still not working</p>

<p>**When I am Calling this method test on onload,It is showing alert of error Conditon.But I have to call it when broswer is closed.In any Case it is not going to web method.</p>
