<< Back to article

jQuery with ASP.NET examples : Ajax Sample


Simple Ajax example, receive current time from server

Get current server time
Code:
        function getServerResponse()
        {
            $("#serverResponse").load("AjaxCall.aspx");
        }
        
        Server side code:
        Response.Write(DateTime.Now.ToString());
        
        

Send data to server

Enter your name :
Send data to server
Code:
        function sendDataToServer()
        {        
            $.get("AjaxCall.aspx"
                    ,{name: $("#txtName").val()}
                    ,function(data)
                    {
                        $("#serverResponseSendData").html(data);
                    });
        }
        
        Server side code:
        Response.Write("Hello " + Request.QueryString["name"] + " !!");
        

For more information:


<< Back to article