daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Mar 19th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.  
  3. $(document).ready(function(e){
  4.  
  5.     $(document).ready(function() {
  6.         $('#signArea').signaturePad({drawOnly:true, drawBezierCurves:true, lineTop:90});
  7.     });
  8.  
  9.     $("#btnSaveSign").click(function(e){
  10.         html2canvas([document.getElementById('sign-pad')], {
  11.             onrendered: function (canvas) {
  12.                 var canvas_img_data = canvas.toDataURL('image/png');
  13.                 var img_data = canvas_img_data.replace(/^data:image/(png|jpg);base64,/, "");
  14.  
  15.                 //ajax call to save image inside folder
  16.                 $.ajax({
  17.                     url: 'save_sign.php',
  18.                     data: { img_data:img_data },
  19.                     type: 'post',
  20.                     dataType: 'json',
  21.                     success: function (response) {
  22.                        window.location.reload();
  23.                     }
  24.                 });
  25.             }
  26.         });
  27.     });
  28.  
  29. });
  30. </script>
  31.    
  32. <?php
  33. if (isset($_post['su'])){
  34.         $su_id= $_post['su'];
  35.         }
  36.         $imagedata = base64_decode($_POST['img_data']);
  37.  
  38.  
  39.            require 'includes/connection.php';
  40. $query2 =mysqli_query($database, "UPDATE `user registration` SET `sign`='$imagedata' WHERE `SupplierID`=$su_id");
  41.  
  42.  
  43. ?>
RAW Paste Data
Top