Refreshing a echoed PHP variable after jQuery AJAX success?

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-05-08T11:51:46Z Indexed on 2010/05/08 11:58 UTC
Read the original article Hit count: 143

Filed under:
|
|

Hello,

I have a shopping cart in Codeigniter in which products are added to the cart using (jQuery) Ajax. In the header of each page it displays the number of contents in the cart using

<?php echo $this->cart->total_items(); ?>

How can I update/refresh this variable when a product is added to the cart, as I am using AJAX to add products to the cart and thus the page isn't being reloaded when products are added. It seems pointless to use AJAX to do asyncronous stuff if I have to reload the page to get the new number of total items from the server.

Many thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX