0

The problem here is that the cart icon does not change the amount automatically on clicking on add to cart

This is the process.php:

session_start();
if (!isset($_SESSION['cart'])){
    echo 0; 
}else{
echo sizeof($_SESSION['cart']);
}

This is the process.php:

    $.post( "process.php", function( data ) {
   console.log(data);
      $('#count').html(data); 
    });

This is the HTML page:

<li  style="float:left; margin-right:15px; color:blue;" class="list"  onclick="toggleCart();"><i class="fa fa-shopping-cart"></i> <span id="count"class="label label-danger"></span></li>
Daniel
  • 2,355
  • 9
  • 23
  • 30
  • Remember that all browsers have developer mode that assist with debugging and inspecting web apps. –  Oct 01 '18 at 16:39
  • thanks have tried dat before putting the question but it not working ..please help – mosesmedia Oct 01 '18 at 17:00
  • "It is not working". What I'm suggesting is that you show your research. You have some code that isn't working. Have you proven that your PHP code is actually being reached and is running? –  Oct 01 '18 at 17:08
  • the cart number changes only when i reload the page so it is getting information from process.php .. my issue is dat it is not auto updating – mosesmedia Oct 01 '18 at 17:17
  • So, this is the sort of information that **should be in the text of the question.** Something like this might help: https://stackoverflow.com/q/22577457/1531971 or https://stackoverflow.com/q/3644585/1531971 (But, of course, it depends on know specifics about your implementation.) –  Oct 01 '18 at 17:21

0 Answers0