时间:2021-07-01 10:21:17 帮助过:9人阅读
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function DoAjax(){
$.post("AjaxTest.aspx",{txt:$("#tbox1").val()},
function(data){
$("#AjaxResponse").text(data);
}
);
}
</script>
</head>
<body>
<p><a href="javascript:DoAjax();">AjaxTest</a><input name="tbox1" id="tbox1" type="text" /></p>
<div id="AjaxResponse"></div>
</body>
</html>
AjaxTest.aspx:
代码如下:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<script runat="server">
string parms;
void Page_Load(object sender , EventArgs e)
{
parms=Request["txt"];
if (String.IsNullOrEmpty(parms)){
Response.Write("Is Null");
}else{
Response.Write(parms);
}
}
</script>