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
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.