javascript - Only refresh parent page -
i using modal show shopping cart. users can delete items in modal. want after delete item, parent page refreshed , modal should still show up. right now, after click on "delete button" in modal, parent page refreshed modal closes up.
my code:
$(function(){ $('.delete').click(function(){ $.ajax({ url:'/polls/cart__delete/'+$(this).attr('data-id'), success: function(data){ $('.modal-body').html(data); parent.location.reload(true); }, }); }); });
$(function(){ $('.delete').click(function(e){ $.ajax({ url:'/polls/cart__delete/'+$(this).attr('data-id'), success: function(data){ $('.modal-body').html(data); parent.location.reload(true); }, error: function (xmlhttprequest, textstatus, errorthrown) {alert('loading failed!!'); } }); e.preventdefault(); }); });
Comments
Post a Comment