I am attempting to AJAX-ify my reports in order to bypass the 100 seconds time-out that CloudFlare imposes on requests that run through its site.
See Is it possible to increase CloudFlare time-out?
I did the following:
function ajaxReport() {
var seconds = prompt("Please enter how many seconds you want the report to run", "5");
$('#imgWaiting').show();
$.post("post/post_ajaxReport.jsp",
{
theParam:seconds
},function(data) {
$('#imgWaiting').hide();
window.location=data;
});
}
and the following for post_ajaxReport.jsp
<%
int theParam=myFunctionToConvertStringToInt(request.getParameter("theParam"));
int a=theParam/60;
int b=theParam-a*60;
String query="WAITFOR DELAY '00:"+a+":"+b+"';";
double d=myCustomCodeToRunQuery(query);
String fileName=createReport();
%>
<%=fileName%>
The code worked great for under 100 seconds. But did not work for over 100 seconds.
Any ideas?
UPDATE AFTER FEEDBACK
My reports work fine now without AJAX (although there is the 100 second time-out with CloudFlare). I was trying to convert them to AJAX in order to avoid grey-clouding a subdomain because I didn't want to expose my IP address. If I was going to grey-cloud a subdomain I would do it on the original code, which would be much simpler than AJAX-ifying my code! My question is "how to fix my AJAX code so that I would have the benefits of avoiding the 100 second timeout, but without the disadvantage of exposing my IP address..."