Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么jQueryAjax阻止加载另一个url页面_Php_Jquery_Ajax - Fatal编程技术网

Php 为什么jQueryAjax阻止加载另一个url页面

Php 为什么jQueryAjax阻止加载另一个url页面,php,jquery,ajax,Php,Jquery,Ajax,在$.ajax请求之后,我无法在浏览器的新选项卡上加载其他页面原因是什么? 此url中的我的javascript代码https://example.com/page1.php: $('#myButton').on("click", function(event) { event.preventDefault(); $.ajax({ url: "models/data.php", type: "POST",

$.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
后,只要ajax请求结束,我就无法在其他选项卡中加载另一个url。例如
https://example.com/page2.php
原因是什么?

如果页面使用PHP会话,则会有一个锁,防止多个页面一次修改会话。因此,第二个脚本将被阻止,直到第一个脚本完成。@Barmar yes完全正确。我的页面使用PHP会话。可以在一个会话中同时使用多个脚本吗?如何使用?使用
session\u write\u close()
来解锁会话。@Barmar非常感谢您提供了准确而简短的答案