title: ajax and codeigniter code for add to cart button
body: <p>iam new to codeigniter and to ajax so i need to add a product to cart 
  the isert function is working and the button changes to 'remove' but when refreshing the page it again changes to add to cart in need to remain it as 'remove' pls help    </p>
  
  <pre><code>    $('.btn_add_remove_cart').click(function(e){
      e.preventDefault();
      var self = $(this);
      if (self.hasClass('add-cart')){ 
          // if it's add cart button, replace add-cart class by remove-cart and change label
          self.removeClass('add-cart').addClass('remove-cart').text('Remove');
      } else {
          // it's remove cart button, do the inverse
          self.removeClass('remove-cart').addClass('add-cart').text('Add to Cart');
      }
  });
  });
  </code></pre>
  
  <p>this my ajax code 
  and my button is </p>
  
  <pre><code>&lt;button name="submit" type="submit" class="btn btn-primary add-cart btn_add_remove_cart btn-default promotion-button" value="&lt;?php echo $row-&gt;prod_id;?&gt;"&gt;add as promotion product&lt;/button&gt;
  </code></pre>