My form is a shopping bag, when .submit () the form # add-cart-head, it adds the product without refresh, but I wanted to have an answer that updates the bag that sits on top of page. The "GET" in the sequence even works, but does not update form.
What to do, or how to do?
jQuery(document).ready(function() {
jQuery('#add-to-cart-head').submit(function() {
var $this = jQuery(this),
dados = $this.serialize();
jQuery.ajax({
type: "POST",
url: $this.attr('action'),
data: dados,
complete: function(){
jQuery.ajax({
type: "GET",
url: "https://modernita.ambienteprotegido.com/cart/update_cart",
data: dados});
},
error: function(){
alert("Deu erro");
}
});
return false;
});
});