help updating cart with ajax

Follow development or suggest a feature.

help updating cart with ajax

Postby lanbo » 13 Jul 2010, 06:12

i followed this person's tutorial

viewtopic.php?f=3&t=371#p999

and it's working fine, without ajax. so if i put
<form name="cart" method="post" action="">
it adds in the detail1 and detail2

but then when i change that to
<form method="post" action="" class="jcart">
it becomes ajax, but it does not update the detail1 and detail2, it just adds in the item like:
Product One $10 [DETAIL 1: ] [DETAIL 2: ]

i think it might be this part:

rosie4tune wrote:And I forgot to mention, if you are using JavaScript/AJAX:

5. jcart-javascript.php
- Add INPUT values for AJAX
- Add to POST call to jcart-relay.php

Code: Select all
      var itemDetail1 = $(this).find('input[name=<?php echo $jcart['item_detail_1']?>]').val();
      var itemDetail2 = $(this).find('input[name=<?php echo $jcart['item_detail_2']?>]').val();

      // SEND ITEM INFO VIA POST TO INTERMEDIATE SCRIPT WHICH CALLS jcart.php AND RETURNS UPDATED CART HTML
      $.post('<?php echo $jcart['path'];?>jcart-relay.php', { "<?php echo $jcart['item_id']?>": itemId, "<?php echo $jcart['item_price']?>": itemPrice, "<?php echo $jcart['item_name']?>": itemName, "<?php echo $jcart['item_qty']?>": itemQty, "<?php echo $jcart['item_add']?>" : itemAdd, "<?php echo $jcart['item_detail_1']?>" : itemDetail1, "<?php echo $jcart['item_detail_2']?>" : itemDetail2 }, function(data) {


i added what is in the code, but maybe i have to do these 2 steps? i don't know how:

- Add INPUT values for AJAX
- Add to POST call to jcart-relay.php
lanbo
 
Posts: 3
Joined: 13 Jul 2010, 06:07

Re: help updating cart with ajax

Postby daminux » 26 Jul 2010, 12:53

Can you give url ?
daminux
 
Posts: 12
Joined: 06 May 2010, 20:06


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest