<!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 src="jquery.min.js"></script>
<script>
$(function(){
$("#btn").click(function(){
$.get("get_content.aspx",{name:$("#name").val(),pwd:$("#pwd").val()},function(data,textStatus){
alert(data);
alert(textStatus);
$("#a").text(data);
});
return false;
});
});
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="" style="background-color:gray">
<label for="textfield">用户名:</label>
<input type="text" name="textfield" id="name" /><br/>
<label for="textfield">密 码: </label>
<input type="text" name="textfield" id="pwd" /><br/>
<input id="btn" type="submit" value="get提交" />
</form>
<br />
<div id="a"></div>
</body>
</html>
服务器文件:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@ Import Namespace="System.Data" %>
<%
Response.Write("用户名:"+Request["name"]+",密码:"+Request["pwd"]+",成功返回");
%>
序列化:
$("#form1").serialize(); //可作为get的输入参数
或var obj={a:1,b:1,c:3};
var k=$.param(obj);
alert(k);