php - What happens to a jQuery Ajax post request if the page is closed while the request is running
Get the solution ↓↓↓I am trying to understand how a jQuery ajax post request is handled if a window is closed while the request is running.
For example, I have the following:
$.ajax({
type : "POST",
data :{ data: large_string, id: $('#theID').val() },
url: "destination.php",
});
destination.php
echo $_POST['data'];
echo $_POST['id'];
If I close the window while the request is sending the data, I get the following error:
Undefined index: id
The large_string variable usually contains several MB of data, and it seems that if the window is closed, destination.php page is still sent the portion of the data parameter that was uploaded, but the id parameter is not even set.
Is there a way to check with PHP for a "canceled" or partial upload?
Thank you!
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: to enable extensions, verify that they are enabled in your .ini files
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.