惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
Cisco Talos Blog
Cisco Talos Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
Project Zero
Project Zero
E
Exploit-DB.com RSS Feed
S
Secure Thoughts
K
Kaspersky official blog
L
Lohrmann on Cybersecurity
NISL@THU
NISL@THU
WordPress大学
WordPress大学
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
小众软件
小众软件
P
Privacy & Cybersecurity Law Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
Hacker News: Ask HN
Hacker News: Ask HN
AWS News Blog
AWS News Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hacker News: Front Page
F
Full Disclosure
Latest news
Latest news
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
T
Troy Hunt's Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
G
GRAHAM CLULEY
Forbes - Security
Forbes - Security
V
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
P
Privacy International News Feed
C
Check Point Blog
N
News and Events Feed by Topic

博客园 - 博闻李

SQL Server数据库所有表索引性能分析 SQL Server数据库所有表重建索引 查询数据库字段所在的位置 查询时锁的使用[转] DBCC DBREINDEX重建索引提高SQL Server性能[引] Javascript键盘输入相关 - 博闻李 - 博客园 VS2008 Web Application和Web Site的区别[转] IIS Temporary ASP.NET Files拒绝访问解决方案 - 博闻李 WebDAV是什么?[引] ASP.NET C# 访问Oracle数据库示例 - 博闻李 VSTS 2008的TFS安装实战[转] - 博闻李 Oracle PL/SQL常用函数列表[转载] - 博闻李 Oracle初学笔记 - 博闻李 SQL Server 索引结构及其使用(一)[转] - 博闻李 SQL数据库设计经验[转] - 博闻李 一套外企的数据库设计面试题[转] - 博闻李 UML在关系型数据库设计中的应用[转] - 博闻李 数据库设计范式深入浅出[转] showModalDialog和showModelessDialog使用[转] - 博闻李
ASP.NET AJAX中PageMethods方法调用示例 - 博闻李 - 博客园
博闻李 · 2009-06-20 · via 博客园 - 博闻李

页面如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
    <script language="javascript" type="text/javascript">
        function Button1_onclick() {
            PageMethods.GetServerTime(alt);
        }
        function alt(result) {
            alert(result);
        }
    </script>

    </form>
</body>
</html>

后台代码如下:

using System;
using System.Web;
using System.Web.UI;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    [System.Web.Services.WebMethod]
    public static string GetServerTime()
    {
        return DateTime.Today.ToString();
    }
}