Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.








Sys.Net.ServerTime Sample


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
    <head id="Head1" runat="server">
        <style type="text/css">
            body {  font: 11pt Trebuchet MS;
                    font-color: #000000;
                    padding-top: 72px;
                    text-align: center }
            .text { font: 8pt Trebuchet MS }
        <title>Simple Web Service</title>
            <script type="text/javascript">
            // This function calls the Web Service method.  
            function GetServerTime()
            // This is the callback function that
            // processes the Web Service return value.
            function OnSucceeded(result)
                var RsltElem = document.getElementById("Results");
                RsltElem.innerHTML = result;
        <form id="Form1" runat="server">
         <asp:ScriptManager runat="server" ID="scriptManager">
                    <asp:ServiceReference path="ServerTime.asmx" />
                <h2>Server Time</h2>
                    <p>Calling a service that returns the current server time.</p>
                    <input id="EchoButton" type="button" 
                        value="GetTime" onclick="GetServerTime()" />
            <span id="Results"></span>