javascript - adding/deleting items from a list and updating the total -
i'm building akin shopping cart adding items shortlist.
i need add item cart , update cart count , display added item in modal window (i'm planning on using reveal plugin zurb).
thus far, i've got adding cart working i'm not yet able update count (without refreshing page) or display modal.
$('a.add-to-shortlist').on('click',function(){ $.ajax({ url: $(this).attr('data-href'), success: function(data) { verb = data['verb']; total_items = data['total_items']; alert('item added shortlist'); } }); // stop event propagation here return false; }); help appreciated.
to change text following e.preventdefault() call, put following within function -
e.preventdefault(); $(this).text('remove list');
Comments
Post a Comment