简体   繁体   中英

Server doesn't respond multiple AJAX request at the same time

In a website i make, we use arrowchat chat plugin. Arrowchat sends AJAX requests once in around 30 seconds to get the online ppl list.

On the other hand, website's navigation system also uses AJAX requests to get the response from server and load content to a div.

The problem is when arrowchat sends AJAX request, if user clicks a navigation link, browser doesn't send requests until arrowchat's AJAX requests is complete.

How can i make it run AJAX requests and get respond from server as parallel ?

Navigation AJAX system;

$("#ajax_content").load("page.php?querys..", function () {
                    $("body").animate({
                        scrollTop: 0
                    }, 800);
                })

EDIT: I already use AJAX as async

It's likely you're locked by session. If you use sessions in your php - then perform session_write_close in page.php as long as you don't need it anymore.

Otherwise other requests wait for session file to be unlocked (on script end)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM