<%@ Page Language="VB" %>
<script runat="server">

    Sub Page_Load(sender As Object, e As EventArgs)
      Ajax.Manager.Register(Me, "My.Page", Ajax.Debug.None)
    End Sub
    
    <Ajax.Method> _
    Public Function GetNow() As DateTime
      Return DateTime.Now
    End Function

</script>
<html>
<head>
<script>
function getNow() {
  My.Page.GetNow(getNowCallBack);
}
function getNowCallBack(result) {
  alert(result.value.toLocaleString());
}
</script>
</head>
<body>
    <form runat="server">
        <h3>Ajax1 (<%= DateTime.Now %>)</h3>
        <input onclick="getNow();" type="button" value="サーバーの日時取得 (非同期)" />
    </form>
</body>
</html>
