码迷,mamicode.com
首页 > Web开发 > 详细

js 弹出窗口 防止拦截,突破阻止,保存后打开

时间:2015-10-22 17:24:28      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

    <script language="javascript">
		function orderprint() {
        var formUrl = "savedata_url";
        var formPrint ="";//保存成功后要弹出的窗口
        $.ajax({
            url: formUrl,
            data: $(‘#form1‘).serialize(),
            dataType: "html",
            async:false,//----------1.重点,先执行当前保存动作
            type: "POST",
            success: function (data) {
                if (data) {
                    formPrint = "http://baidu.com";
                }
                else {
                    alert("保存失败");
                }
            },
            error: function () {
                alert("保存失败");
            }
        });
        if(formPrint !== "") {//-----------2.保存成功才打开
            openPrint(formPrint);
        }
    }
    function openPrint(formPrint){//弹窗不被过滤
        var mypop=window.open(formPrint,"_blank");
        try{
            mypop.focus();
        }catch(e){
        }
        document.location.reload();//-------------3.保存成功后重新加载当前页
    }
    
    </script >

  

js 弹出窗口 防止拦截,突破阻止,保存后打开

标签:

原文地址:http://www.cnblogs.com/eugenewu0808/p/4901204.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!