-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign.php
78 lines (61 loc) · 2 KB
/
sign.php
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//$data = array();
//sc_lookup(data, "SELECT sign FROM Table_4 WHERE id='2222'");
//echo $data[0][0];
?>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<title>CMA | Timesheet System</title>
</head>
<body>
<div id="signature-pad" class="signature-pad">
<div class="signature-pad--body">
<canvas id="canvas"></canvas>
</div>
<div class="signature-pad--footer">
<div class="description">Sign above</div>
<div class="signature-pad--actions">
<div>
<button type="button" class="button clear" data-action="clear">Clear</button>
<button type="button" class="button" data-action="undo">Undo</button>
</div>
<div>
<button type="button" class="button save" data-action="attach-sig">Attach signature</button>
</div>
</div>
</div>
</div>
<!--signature_pad.umd.js-->
<script type="text/javascript" src="<?php echo sc_url_library('prj', 'php-boys', 'signature_pad.umd.js');?>"></script>
<!--app.js-->
<script type="text/javascript" src="<?php echo sc_url_library('prj', 'php-boys', 'app.js');?>"></script>
<img id="img"/>
<script>
var blobz;
attachSig.addEventListener("click", function (event) {
if (signaturePad.isEmpty()) {
alert("Please provide a signature first.");
} else {
var dataURL = signaturePad.toDataURL();
var data = new FormData();
data.append('file', dataURL);
//console.log(data);
$.ajax({
url: "/scriptcase/app/project/blankapp2/blankapp2.php",
type : "POST",
cache : false,
data : data,
processData: false,
contentType: false,
success: function(data){
alert(data);
console.log(typeof(data));
$('#img').attr('src',data);
},
error: console.log.bind(console, "failed post")
});
}
});
</script>
</body>
<?php