asp.net jquery+ajax异步刷新实现示例
发布时间:2020-12-15 20:32:37 所属栏目:asp.Net 来源:网络整理
导读:复制代码 代码如下: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns="http://www.w3.org/1999/xhtml" head title/title script charset="gb1232" src="Scripts/jque
复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script charset="gb1232" src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script type="text/javascript"> // function sys() { // $.post("test1.ashx",{"Name":$("#text1").val()},function (data) { // $("#text2").val(data); // });//第一种方案,要在text1添加onblur="sys()"事件响应 // } $(document).ready(function () { $("#text1").blur(function () { $.post("test1.ashx",{ "Name": $("#text1").val() },function jy(data) { $("#text2").val(data); }); }); });//第二钟方案 </script> </head> <body> <input type="text" id="text1" /> 转换 <input type="text" id="text2" /> </body> </html> asph处理程序如下: 复制代码 代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace 异步刷新 { /// <summary> /// test1 的摘要说明 /// </summary> public class test1 : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request["Name"]; context.Response.Write(name); } public bool IsReusable { get { return false; } } } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 如何在加载数据时创建页面覆盖 – asp.net/jquery/blockui
- asp.net-mvc – 缓存的最佳解决方案
- asp.net-mvc – 嵌套对象的远程ViewModel验证无效
- asp.net-mvc – ValidateInput(false)和AllowHtml属性仍导致
- .NET Core和Classic ASP在同一解决方案中?
- asp.net-mvc-3 – 使用ViewData将字符串从Controller传递到
- asp.net – ASP:登录总是生成一个,我怎么能让它停止?
- asp.net-membership – 泛型和ASP.Net成员资格提供者
- 实现ASP.NET多文件上传程序代码
- asp.net-mvc-4 – 未找到入口点异常