asp.net jquery+ajax異步刷新實(shí)現(xiàn)示例
更新時(shí)間:2013年09月02日 16:12:32 作者:
異步刷新想必大家并不陌生吧,本文主要為大家介紹下asp.net jquery+ajax實(shí)現(xiàn)異步刷新過程,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:
<!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()"事件響應(yīng)
// }
$(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" />
轉(zhuǎn)換
<input type="text" id="text2" />
</body>
</html>
asph處理程序如下:
復(fù)制代碼 代碼如下:
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;
}
}
}
}
相關(guān)文章
ajax 實(shí)現(xiàn)微信網(wǎng)頁授權(quán)登錄的方法
這篇文章主要介紹了ajax 實(shí)現(xiàn)微信網(wǎng)頁授權(quán)登錄的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-03-03Ajax實(shí)現(xiàn)城市二級(jí)聯(lián)動(dòng)(二)
這篇文章主要為大家詳細(xì)介紹了Ajax實(shí)現(xiàn)城市二級(jí)聯(lián)動(dòng)的相關(guān)資料,將省份用ajax請(qǐng)求并渲染,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-02-02Ajax案例集下載:新增分頁查詢案例(包括《Ajax開發(fā)精要》中的兩個(gè)綜合案例) 下載
Ajax案例集下載:新增分頁查詢案例(包括《Ajax開發(fā)精要》中的兩個(gè)綜合案例) 下載...2007-05-05