Let's say I have a simple jQuery POST script:
$(document).ready(function () {
$.post("post-data.php")
.done(function (data) {
// Done function
}).fail(function () {
// Fail function
});
});
Let's say I have this HTML:
<div id="page">
<a href="link.php">Some link</a>
<div id="jquery-data-response"></div>
</div>
If post-data.php returns data after 10 seconds and I click on "Some link" within 10 seconds, the page "link.php" is loaded after the jQuery POST request is completed, so the user has to wait for a maximum of 10 seconds.
This applies to jQuery GET requests as well.
Now I have two questions.
- Where is the problem? Is it a Server issue (let's assume that the script is fully optimized and can't be faster than 10 seconds, it happens on localhost with XAMPP too), a jQuery issue (a missing function that handles user-interactions?) or a browser issue (does Chrome have to wait before all requests are processed?)?
- Is it possible to solve this issue (and how)?