【发布时间】:2013-04-25 07:14:26
【问题描述】:
我在使用 Ajax 和 CodeIgniter 购物车时遇到问题。该代码在没有 AJAX 的情况下运行良好。好像不能发帖了。
<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>
【问题讨论】:
-
查看这个教程,了解带有 CI 的 ajax 购物车真的很好 net.tutsplus.com/tutorials/php/…
-
检查您发帖的网址。在浏览器中使用某种开发工具:Chrome - 开发者工具 (F12)、Firefox - 安装 Firebug 插件
标签: jquery ajax codeigniter cart