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 6376211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:42:57+00:00 2026-05-25T01:42:57+00:00

Suppose I make an AJAX HTTP Request from jQuery to a backend PHP script.

  • 0

Suppose I make an AJAX HTTP Request from jQuery to a backend PHP script. The request is made, the PHP script starts running and doing its magic. Suppose I then change to another website, away from the site where the original AJAX Request was made. As well, I do this before the PHP script finishes and has time to do a HTTP Response back. Does the PHP script finish running and doing its thing even though I’ve switched to another website before I got the HTTP Response?

So the order is this.

  • I’m on website http://www.xyz.com
  • I have a jQuery handler that kicks off an AJAX request to blah.php
  • blah.php starts running
  • I go to website http://www.abc.com soon after without waiting for a response from blah.php

What’s going on with blah.php? Is execution still going on? Did it stop? I mean it didn’t get a chance to respond so…

  • 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-25T01:42:58+00:00Added an answer on May 25, 2026 at 1:42 am

    This may depend on your server configuration, but in general the script will continue to execute despite a closed HTTP connection.

    I have tested this with Apache 2 + PHP 5 as mod_php. I would expect similar behaviour with PHP as CGI and with other webservers but do not know for certain.

    The best way to determine for certain on your configuration is, as @tdammers suggests: set up a test script something like the following and monitor the log.

    <?php
    error_log('Test script started.');
    for ($i = 1; $i < 13; $i++) {
        sleep(10);
        error_log('Test script got to ' . (10 * $i) . ' seconds.');
    }
    error_log('Test script got to the end.');
    ?>
    

    Access this script (at /test.php or whatever) then before you get any results, hit stop on your browser. This is equivalent to navigating away before your XHR returns. You could even have it as the target of an XHR and navigate away.

    Then check your error log: you should have a start and then messages every 10 seconds for two minutes and an end. You can modify how high $i gets to ensure your script will reach its anticipated maximum execution time if you’d like to test that too.

    You don’t have to use error_log() – you could write to a file, or make some other persistent change on the server that can be checked without needing to keep the client connection open.

    The script execution time may stop before then because of the max_execution_time php.ini directive – but in any case this should be distinct from when the webserver times out.

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

Sidebar

Related Questions

Suppose I make an AJAX HTTP Request from jQuery to a back-end PHP script
Suppose the jQuery object of the input is $input. How to make its value
Is it possible to make AJAX-calls (e.g. using jQuery.ajax() ) from local html/js file
Suppose you want to make an async request in JavaScript, but you want to
I'm developing a web site, which would make use of PHP, Javascript (JQuery) and
Possible Duplicate: Run one instance from the application let's suppose i make an application
Suppose I use JQuery to do an ajax call, and the result is returned
Suppose I want to make a Web application which uses a fixed width and
Suppose I have an element called #container-main . How do I make that display:none
Suppose this is my URL route: (r'^test/?$','hello.life.views.test'), How do I make it so that

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.