Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. jQuery("#product-addtocart-button").on('click', function() {
  2. var canvas = jQuery('canvas.canvas');
  3. var canvasImage = canvas[0].toDataURL("image/jpeg", 0.7);
  4.  
  5. jQuery.ajax({
  6. type: "POST",
  7. dataType: 'json',
  8. url: UPLOADER_URL,
  9. data: {
  10. imgBase64: canvasImage
  11. }
  12. }).done(function(response) {
  13. last_option.val(response.filename);
  14. console.log("Generated filename", response.filename);
  15. // TRIGGER ADD TO CART FUNCTION HERE
  16. // BUT THE ADD TO CART IS BEING TRIGGERED EVEN IF THE AJAX IS NOT YET FINISH
  17. });
  18.  
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement