Shopping cart in jquery with php and session -
good day!
i'm learning jquery creating basic shopping cart add cart buttons, remove items , clear buttons works in jquery.
the function save added items on session , can remove , clear jquery. have idea on how jquery works on adding items. not on removing single item or clear of them on cart.
any help, suggestion appreciated.
thanks... :d
here code have done far on shopping cart. in 2 files index.php , cart.php add cart button working except remove , clear. because not able run session yet.
here is:
<script type="text/javascript"> // ajax $(document).ready(function(){ $(".add").click(function(){ var id = $(this).attr("proid"); var item = $("#item"+id).val(); var brand = $("#brand"+id).val(); var price = $("#price"+id).val(); var quantity = $("#quantity"+id).val(); $.ajax({ type: "post", url: "cart.php", data: "id="+ id + "& item="+ item + "& brand="+ brand +"& price="+ price +"& quantity="+ quantity, success: function(data){ $("#jcart").html(data); } }); //ajax return false; }); //click function //show empty table $("#jcart").load("jcart.php"); //--> options $(".remove").click(function(){ var id = $(this).attr("proid"); $.ajax({ type: "post", url: "clear.php", data: "id="+ id, success: function(data){ $('#jcart').html(data) } }); }); $(".clear").click(function(){ $.ajax({ type: "post", url: "clear.php", success: function(data){ $("#jcart").html(data) } }); }); }); </script>
i'm making difficult session on how items being save retrieve. ideas or appreciated...
thanks in advance!
there fair few tutorials out there create (what sounds like) looking for.
- tutorialzine : ajax based shopping cart php, css & jquery
- webresourcesdepot : creating slick ajaxed add-to-basket jquery , php
- webresourcesdepot : ajaxed sliding shopping cart jquery
have read of them, along php manual sessions, , see can come with. if make start, , stuck, come back, ask more questions (with examples , code samples) , can help.
Comments
Post a Comment