復(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;
}
}
}
}
您可能感興趣的文章:- jQuery ajax請(qǐng)求struts action實(shí)現(xiàn)異步刷新
- php+jQuery+Ajax簡單實(shí)現(xiàn)頁面異步刷新
- jQuery使用$.ajax進(jìn)行異步刷新的方法(附demo下載)
- Ajax實(shí)現(xiàn)異步刷新驗(yàn)證用戶名是否已存在的具體方法
- ajax異步刷新實(shí)現(xiàn)更新數(shù)據(jù)庫
- ajaxpro.dll 控件實(shí)現(xiàn)異步刷新頁面
- 如何手寫Ajax實(shí)現(xiàn)異步刷新