1.动态加载之后单击事件失效使用
$("body").delegate(".souc","click",function(){});
$("body").delegate(".souc","click",function(){
var collect = $(this).attr("rel");$.ajax({
url: ctx + "/api/shop/collect/add-collect.do?goods_id="+collect,
dataType:"json",
success:function(result){
if(result.result==1){
alert("收藏成功");
}else{
alert(result.message);
}
},error:function(){
alert("抱歉,收藏出现意外错误");
}
});
});