Demo entry 2335684

test222

   

Submitted by anonymous on Aug 03, 2015 at 12:51
Language: JavaScript. Code size: 724 Bytes.

$(document).ready(function() {
    $(".update_cart").click(function(e) {
      e.preventDefault();
      var itemsCount = $(this).closest("td").prev()
        .children(".quantity").val();
      if(isNaN(itemsCount) || parseInt(itemsCount, 10) < 0 ||
          parseInt(itemsCount, 10) > 10) {
          showError("Nao é numero valido");
          return;
      }
      $.ajax({
        url: '/updatecart',
        data: {
          // lógica para formatar os dados a serem enviados para o servidor
        },
        success: function(data) {
          // update table with cart data
        },
        error: function(xhr, status, error) {
          // handle error
        }
      });
    });
  });

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).