代码之家  ›  专栏  ›  技术社区  ›  Farzad

为什么jquery ajax阻止加载另一个url页面

  •  0
  • Farzad  · 技术社区  · 8 年前

    之后 $.ajax 请求时,我无法在浏览器的新选项卡上加载其他页面。 原因是什么?

    我在这个url中的javascript代码 https://example.com/page1.php :

    $('#myButton').on("click", function(event) {
         event.preventDefault();
    
         $.ajax({
                    url: "models/data.php",
                    type: "POST",
                    data: {...},
                    dataType: 'json',
                    context: this,
                    success: function(data) {
                         //...
                    },
                    error: function (asd, textStatus, errorThrown) {
                         //...
                    }
    
                });
    });
    

    点击后 myButton 我不能在其他选项卡中加载其他url,只要ajax请求结束。例如 https://example.com/page2.php 原因是什么?

    0 回复  |  直到 8 年前