Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // Save the canvas on facebook share click
  2. $('.button').on('click', function(e) {
  3. // e.preventDefault();
  4. // console.log(canvas);
  5. var dataURL = canvas.toDataURL();
  6. // window.open(canvas.toDataURL('image/png'), '_blank');
  7. $.ajax({
  8. type: "POST",
  9. url: "save.php",
  10. data: {
  11. imgBase64: dataURL,
  12. imageUrl: hash
  13. }
  14. }).done(function(o) {
  15. console.log('saved');
  16. // If you want the file to be visible in the browser
  17. // - please modify the callback in javascript. All you
  18. // need is to return the url to the file, you just saved
  19. // and than put the image in your browser.
  20.  
  21. // Redirect to trailer page after share
  22. // Has to be placed inside of done function otherwise image occasionaly doesn't render for mobile in time
  23. window.location.href = "/";
  24. });
  25.  
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement