Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:08:21+00:00 2026-05-31T13:08:21+00:00

When i send two ajax requests together using JQuery .. the response come together

  • 0

When i send two ajax requests together using JQuery .. the response come together

for example

$.ajax
({
    type: "POST",
    url: 'ajax.php'
});
$.ajax
({
    type: "POST",
    url: 'ajax2.php'
});

ajax.php , ajax2.php are two files contain a dummy for loop take about 5 sec.

FireBug Screen

POST localhost/ajax.php 200 OK 4.77s
POST localhost/ajax.php 200 OK 4.37s

Here every request take about 5 sec to be executed …..

When i do the same example at symfony i got different result

$.ajax
({
    type: "POST",
    url: 'module/action1'
});
$.ajax
({
    type: "POST",
    url: 'module/action2'
});

action1 , action2 are two action just contain a dummy for loop take about 5 sec.

FireBug Screen

POST localhost/web/frontend_dev.php/module/action1 200 OK 4.47s

POST localhost/web/frontend_dev.php/module/action2 200 OK 9.87s

Notice that the second request executed after the first one finished , i don’t know why that happened

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:08:23+00:00Added an answer on May 31, 2026 at 1:08 pm

    When a request comes in, and it tries to start a session, php will check if the same session is in use at that moment. If it is, the new request has to wait till the other request finishes, or releases the session lock.

    Your case is the following:

    • first request arrives, lock session
    • second reauest arrives, tries to lock session, has to wait
    • [ 5 sec sleep ]
    • first request finishes, releases lock
    • second request starts, achieves session lock
    • [ 5 sec sleep ]
    • second request finishes

    By default symfony starts the session at the beginning of every request.

    In pure PHP you can release the session file’s lock with session_write_close(). Symfony has the sfUser class which wraps session functinality, you’ll need to call it’s shutdown() method.

    Be advised that if you modify any session data later in that request, it will not get saved.

    For a more detailed explanation, read PHP Session write locking and how to deal with it in symfony.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

By using jquery ajax function, I can do something like: $.ajax({ url: url, type:
Is it possible to send Ajax requests to two or more Php scripts simultaneously?
I am using dojo and ajax to send a time stamp to PHP, which
I have an jquery ajax request that calls a PHP script that will send
I have made an AJAX chat using Javascript, PHP, and MySQL. I send the
I use ASINetworkQueue to send two requests, which are in a queue. My problem
I am attempting to send an email using VB.NET. There are two requirements: The
I am using servlet there is two method redirect and forward both are send
I am using the comet long-polling technique with apache, php, jquery. I've got a
What is the difference between GET and POST for Ajax requests? I don't see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.