####success error简单封装
````
function success(msg){
layer.msg(msg,{icon:1});
}
function error(msg){
layer.msg(msg,{icon:0});
}
````
#### ajax模板
````
$.ajax({
url:url,
data:{uid:uid},
type:"post",
dataType:"json",
beforeSend: function(){
$('.loading').css('display','block');
},
success:function (data) {
$('.loading').css('display','none');
$('.count').html(data.count);
$('.pv').html(data.pv);
}
})
````
#### 询问确认模板
````
function del(id) {
layer.confirm('确定要删除吗?', {
btn: ['确定','取消'] //按钮
}, function(){
//layer.msg('的确很重要', {icon: 1});
var url = "{:url('delete')}";
layer.load();
$.post(url,{id:id},function(e){
layer.closeAll();
if(e.code ==200 ){
layer.msg(e.msg, {icon: 1});
location.reload();
}else {
layer.msg(e.msg, {icon: 0});
}
},'json')
}, function(){
layer.msg('取消成功', {icon: 1});
});
}
````
#### json return模板
````
return json(["code"=>200,"msg"=>"成功","data"=>""]);
````
#### post提交模板
````
````