I have once ajax call which does connect to database, sets one flag in database and waits for one file to be created by some other process which looks up the flag.
Till the file is created on server, ajax keeps waiting. Once file is created, ajax reads the file and displays the content.
Now issue is that sometime the backend process which creates the file, stuck into socket issue, and never created the file, but ajax keeps waiting in that case, which gets timedout only when its timeout occurs,
What all I want to show a stop request button, which could stop current ajax request as timeout is long, and user could want to stop it prior to timeout.
Here is what I tried, I modified the code which keeps looking the existence of file, and added a session variable check , like if Session("AbortCheck") = true then exitout from the script.
and placed another ajax call to update the sessin variable so that on loop when the script will find session = true it will immediately stop the request.
While debugging I found that my my new ajax request which updates the session variable actually executed only when the first ajax is completed. and therefore its never stopped on user request to stop the request.
Could anyone let me know how to stop a running ajax (which is taking time) on user input ?
Thanks