html,,,,,任务提示,,, $(document).ready(function() {, $("#btnShowAlert").click(function() {, $.ajax({, type: "POST",, url: "TaskAlert.aspx/GetTaskAlert",, contentType: "application/json; charset=utf-8",, dataType: "json",, success: function(response) {, alert(response.d);, },, failure: function(response) {, alert("Error: " + response.d);, }, });, });, });,,,,,,,,,,,
`,,在后端的
TaskAlert.aspx.cs 文件中,添加以下代码:,,
`csharp,using System;,using System.Web.Services;,,public partial class TaskAlert : System.Web.UI.Page,{, protected void Page_Load(object sender, EventArgs e), {, },, [WebMethod], public static string GetTaskAlert(), {, return "您有一个新的任务需要完成!";, },},
``,,这段代码展示了如何使用jQuery和ASP.NET AJAX来实现一个简单的任务提示功能。当用户点击按钮时,会通过AJAX请求从服务器获取任务提示信息并显示在弹出框中。Powered By Z-BlogPHP 1.7.3