一、目的
- 使用Jquery获取form中所有控件值,并封装成JSON
- 清空form
二、代码实现
2.1 head
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<title>Document</title>
</head>
2.2 body
<body>
<form method="post" action="" id="form">
用户名: <input type="text" name="username"><br>
密码: <input type="text