Submitting a long running Ajax request in XPages

This is definitely not best practice, but sometimes there is a need to fire an Ajax request which might take a long time, I have just come across just such a situation. In XPages, the default timeout for Ajax requests is 20 seconds, after that you get an alert which says there was a problem and would you like to submit the whole page. But what if you need to exceed that? 

Well it’s very simple really. Once the page loads, you just need to increase the timeout:

XSP.submitLatency = 30000;

The number is the timeout in milliseconds which you want to support. 

As I said, not best practice, but if you ever need it, then simple to do.