-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathserializeFormJSON.html
More file actions
46 lines (43 loc) · 1.17 KB
/
serializeFormJSON.html
File metadata and controls
46 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<head>
<script src="js/jquery.js"></script>
<script src="vendor/bootstrap/js/bootstrap.js"></script>
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap-theme.min.css">
<script src="js/gonrin.core.js"></script>
</head>
<body>
<form id="formid" action="#" method="post">
<div>
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</div>
<div>
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</div>
<div>
<label for="password">Password</label>
<input type="password" name="password" id="password" />
</div>
<p>
<button id="btn" type="button" >Sent</button>
</p>
</form>
<script>
$(document).ready(function(){
$('#btn').click(function (e) {
e.preventDefault();
var data = gonrin.serializeFormJSON($('#formid'));
console.log(data);
/* Object
email: "value"
name: "value"
password: "value"
*/
});
});
</script>
</body>
</html>