87,964
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>测试ajax</title>
<script src="JS/jquery-3.3.1.min.js"></script>
<script>
$(document).ready(function () {
$.ajax({
type: "POST",
data: '"test": "test" ',
url: "Wlingshou.ashx",
success: function (result) {
alert(result);
},
error: function (xhr) {
alert("错误提示: " + xhr.status + " " + xhr.statusText);
}
});
}
</script>
</head>
<body>
</body>
</html>
<%@ WebHandler Language="C#" Class="Wlingshou" %>
using System;
using System.Web;
public class Wlingshou : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}