<!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=utf8" />
<title>demo</title>
</head>
<body>
<script type="text/javascript" src="http://files.cnblogs.com/tinyphp/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('form').submit(function(event)
{
event.preventDefault();
var t=$(this).serialize();
$.get('a.php',t,function(data)
{
console.log(data);
})
})
})
</script>
<form action="" method="post">
名字:<input type="text" value="tom" name="name"/>
<input type="text" name="age" value="10"/>
<span id="a">提示</span>
<input type="submit" value="tijiao" name="submit"/>
</form>
</body>
</html>
a.php打印下$_GET得到:
Array
(
[name] => tom
[age] => 10
)
$(this).serialize() 相当于 name=tom&age=10