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.
<script type="text/javascript">
$('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;
});
</script>