写一个Handler
前台调用jsnamespace WebTest.handle { /// <summary> /// myHandler1 的摘要说明 /// </summary> public class myHandler1 : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request["tname"]; context.Response.Write("Hello World!"+name); } public bool IsReusable { get { return false; } } } }
<script type="text/javascript"> function text_ajax() { var tt = $("#text1").val(); alert(tt); $.post("handle/myHandler1.ashx", {tname:tt} , function (data) { alert(data) }); } </script>
ashx+jquery+ajax 不多数 上代码
最新推荐文章于 2024-07-25 12:41:07 发布