web前端购物车功能实现
其实思路都是很简单的,如果你要纯前端的实现,那用Javascript或者jquery就可以做了,如果想前后端联动,那么具体数据操作你就提交到后台,然后后台重新返回页面就可以了
$.post( basePath+/shoppingcar/selectAll.do, {}, function(result){ if(result.success){ var obj=result.data; $(obj).each(function(index){ var url=upload/image/+this.car_id+/+this.car_image+/+this.wl_image_a+; addshop='
'; addshop+=''+this.car_name+''; addshop+=''+this.car_price+''; addshop+=''; addshop+=''+this.car_price+''; addshop+=''; addshop+=''; $(.shopcar).prepend(addshop); $(.shopcar).append(''); });$(img).bind(click,function(){ var cc=$(this).attr('alt'); location.href=training.html?id=+cc+; }); mode(); }else{ } });}