ajax的提交和跳转,待完善

function do_vote(_this,voteid,optionid,verify){
    var url="{:addons_url('Vote://Wap/join')}";
    $.post(url,{'vote_id':voteid,'option_id':optionid,'verify':verify},function(res){
        if(res.error&&res.isguanzhu=="no"){
             $.Dialog.fail(res.error);
             $(_this).removeClass('has_vote');
             setTimeout(function(){
                location.href="{:addons_url('Vote://Wap/gongzhonghao')}&vote_id={$vote_info.id}";
            },1500)
        }else if(res.isguanzhu!="no")
        {
            $.Dialog.fail(res.error);
             $(_this).removeClass('has_vote');
        }
        else{
             $.Dialog.success(res.success);
             setTimeout(function(){
                location.href="{:addons_url('Vote://Wap/index')}&vote_id={$vote_info.id}";
            },1500)
        }
    });
}

框架为onethink,通过js提交post到后台control类的方法,ajaxreturn包含参数在回调中判断是否跳转……

posted @ 2017-04-24 14:59  景北斗  阅读(211)  评论(0编辑  收藏  举报