jquery 获取表单数据

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  console.log($("form").serialize()); // FirstName=Bill&LastName=Gates
});

</script>
</head>

<body>

<form>
<input name="name" value="admin"/>
<input name="age" value="18"/>
</form>
</body>

</html>

可以看到控制有"name=admin&age=18"

相关推荐