asp.net jquery+ajax异步刷新实现示例

少了你的风景,我没有美丽的人生。天气真好!一起去郊游吧,拥抱大自然,呼吸清新的空气,享受悠闲和温馨。
 
<!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+ajax异步刷新实现示例。一粒灰尘,改变不了大海的明净;一颗石子,阻挡不了江河的前进;一丝乌云,遮挡不了太阳的光辉;一次灾难,破坏不了勇者的励志。更多关于asp.net jquery+ajax异步刷新实现示例请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
ASP.NET与Ajax的实现方式小总结

浅析Asp.net MVC 中Ajax的使用

asp.net 全部选中与取消操作,选中后的删除(ajax)实现无刷新效果

[ASP.NET AJAX]Function对象及Type类的方法介绍

asp.net中mvc使用ajax提交参数的匹配问题解决探讨