Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. jQuery(document).ready(function(){
  2.  
  3. jQuery('#shopping-cart-table')
  4. .on(
  5. 'change',
  6. 'input[name$="[qty]"]',
  7. function(){
  8. var form = jQuery(jQuery(this).closest('form'));
  9.  
  10. // we'll extract the action and method attributes out of the form
  11.  
  12. // kick off an ajax request using the form's action and method,
  13. // with the form data as payload
  14. jQuery.ajax({
  15. url: form.attr('action'),
  16. method: form.attr('method'),
  17. data: form.serializeArray()
  18. });
  19. }
  20. );
  21.  
  22. var formData = form.serializeArray();
  23. formData.push({'update_cart_action' : 'update_qty'})
  24.  
  25. jQuery.ajax({
  26. url: form.attr('action'),
  27. method: form.attr('method'),
  28. data: formData
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement