weixin_33728708 2015-07-13 12:11 采纳率: 0%
浏览 41

ajax异步在浏览器中工作

I write a java script function in that i call Ajax to open window in same tab .when i am setting async:false it works in Mozilla but doesn't get work in chrome and IE.To work in Chrome and IE we need to set async:true but after setting async:true it doesn't work in Mozilla. the following code i am using

example.

var t = document.getElementById('toolt').title = 'test';
t = 'test'
function loadEditWindow() {
    window.setTimeout(function () {
        $.ajax({
            async: false,
            success: function (MSG) {
                window.open('URL', "_self");
            }

            return false;


        },
        error: function (MSG) {
            alert("Error");
        }

        });
    }, 2000);
return false;
}
  • 写回答

1条回答 默认 最新

  • weixin_33695450 2015-07-13 12:16
    关注

    I tried cleaning up your code.

    Try this:

    function loadEditWindow() {
        window.setTimeout(function () {
            $.ajax({
                async: false,
                success: function (MSG) {
                    window.open('URL', "_self");
                },
                error: function (MSG) {
                    alert("Error");
                }
            });
        }, 2000);
    
        return false;
    }
    
    评论

报告相同问题?