title: Codeigniter Shopping Cart with Ajax
body: <p>I am having a problem with Ajax and the CodeIgniter shopping cart. The code works well without AJAX. It seems I am unable to post.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('ul.products form').submit(function(){
  
        $('#noticeMessages').empty(); 
          var id = $(this).find('input[name=id]').val();  
  
    $.ajax({
            type: 'post',
            url:'../books/addProduct',
            data:{id:id}
            }).done(function(data){
  
                $('#noticeMessages').append('Your product has been added').css('visibility','visible').fadeIn('fast').fadeOut(5000);
                location.reload();
  
            });
            return false;
      });
  &lt;/script&gt;
  </code></pre>