jquery ajax call not asynchronous

后端 未结 2 1966
醉话见心
醉话见心 2021-01-14 10:07

I am fresh to jQuery\'s implementation of it\'s AJAX methods.

I have a simple setup that accesses two different pages, one which takes 10 seconds to complete (I have

2条回答
  •  广开言路
    2021-01-14 10:33

    I have discovered the cause of the javascript call hanging.

    To prevent a race condition from occurring with user session data, PHP locks the data until one of two conditions occur.

    1. The previously called PHP script calls session_write_close().

    2. The previously called PHP script completes processing and implicitly calls session_write_close().

    Following the logic that a call to the server that does not call session_start() should allow true asynchronous calls, I created a dummy PHP page that just spits out a simple string and called to that page every second while the 10 second script ran. It ran perfectly.

    The solution came from reading this discussion on the symfony forums.

提交回复
热议问题