transport.php
<!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=utf-8" />
<title>向另一个页面传输数据</title>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.min.js"></script>
</head>
<body>
<script type="text/javascript">
function test(){
$.ajax({
type:'POST',
url:'tra.php',
data : $.param({
user : $('form input[name=user]').val(),
age : $('form input[name=age]').val(),
sex : $('form input[name=sex]').val()
}),
success:function(response){
document.write(response);
},
})
};
</script>
<form >
姓名:<input type="text" name="user" /><br />
年龄:<input type="text" name="age" /></br>
性别:<input type="radio" name="sex" value="男" />男
<input type="radio" name="sex" / value="女">女<br />
<input type="button" value="提交" onclick="test()" />
<input type="reset" value="重置" />
</form>
<div id="box" ></div>
</body>
</html>
tra.php
<?php
$_user=$_POST['user'];
$_age=$_POST['age'];
$_sex=$_POST['sex'];
echo $_user.' - '.$_age.' - '.$_sex;
?>