Assuming I run a cycling function through ajax that is waiting for a response from the device (in this case, a barcode reader), I need to make another ajax call if the back button is pressed (while the first function remains running). How can I do that? Using an interrupt does not work because the server is still in a loop. Any idea?
Just send another ajax request, you can execute multiple ajax requests at the same time.
sendFirstAjax(); sendSecondAjax(); // doesn't have to wait the first ajax to complete.