forked from Aleksandr-ru/serializeObject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
41 lines (39 loc) · 1.27 KB
/
demo.html
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
<html>
<head>
<title>serializeObject with files by aleksandr.ru</title>
<style>
p {
font-style: italic;
}
</style>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="jquery.serializeObject.js"></script>
<script>
$(function(){
$('form').on('submit', function(e){
e.preventDefault();
$(this).serializeObject().done(function(o){
if(window.console) console.log(o);
var j = JSON.stringify(o);
alert(j);
//window.open("data:image/png;base64," + o.userfile.data);
});
});
});
</script>
</head>
<body>
<h1>jQuery Serialize Object with files support</h1>
<form>
<p><input type="text" name="textinput" placeholder=""> input[name=<q>textinput</q>]</p>
<p><label><input type="checkbox" name="chk_no_val"> :checkbox[name=<q>chk_no_val</q>]</label></p>
<p><label><input type="checkbox" name="chk_value" value="the-value"> :checkbox[name=<q>chk_value</q>]</label></p>
<p><input type="file" name="userfile"> input[name=<q>userfile</q>]</p>
<p><input type="file" name="file_multiple" multiple="multiple"> input[name=<q>file_multiple</q>]</p>
<p><input type="submit"></p>
</form>
<address>
©2017 <a href="aleksandr.ru">aleksandr.ru</a>
</address>
</body>
</html>