Reputation: 71
This is a simple snippet of code to launch an aynchronous ajax request. The processing time of the request is deliberately long (10 seconds or more).
Why browser prevent my users to click on a href link during the process of the async request ? (tried with Firefox and Chrome)
The async request is normally called and the 'Ready' message is immediately displayed in console.
Snippet :
new Ajax.Request('index.php', {
method: 'post',
asynchronous: true,
parameters: { 'sleep': 10 },
onSuccess: function(transport) { console.log('Success'); },
onFailure: function() { console.log('Error'); }
});
console.log('Ready');
Upvotes: 2
Views: 735
Reputation: 71
PHP is the cause of the problem here. When you do session_start() the PHP locks the session file so there’s no concurrent writing to this file and gives the running script full access to the session variables ( reading and writing ).
So you need to call session_write_close() as soon as possible.
Upvotes: 3