setTimeout(function(){
self.location='{:url('course',['pid'=>$pid,'cid'=>$cid])}';
},1000);
例子:
//创建直播
$(document).on("click",".addlive",function(){
var arrid = $(this).attr("lay-id");
var strs= new Array(); //定义一数组
strs=arrid.split("|"); //字符分割
pid= strs[0];
cid= strs[1];
bid= strs[2];
ccid= strs[3];
var index = layer.load(1, {
shade: [0.5,'#000'] //0.1透明度的白色背景
});
$.ajax({
url:'{:url('course_add')}',
type:"post",
data:{pid:pid,cid:cid,bid:bid,ccid:ccid,action:'addlive'},
async:true,
success:function(data){
layer.closeAll('loading'); //关闭加载层
if(data['code']==1){
layer.msg(data['msg']);
}else{
layer.msg(data['msg']);
//table.render({});//重新渲染
}
setTimeout(function(){
self.location='{:url('course',['pid'=>$pid,'cid'=>$cid])}';
},3000);
},
error:function(){
layer.closeAll('loading'); //关闭加载层
layer.msg('失败!');
}
});
});