I have a form where you select the parameters to generate a PDF report that will be returned by a Struts 1.x action that will be opened by the browser. This is working perfectly synchronously in the system.
But what I need to protect the system from the user is requesting the report without having done all the time, putting a lock on the button to be enabled only once the report was generated.
My choice was to create a function in AJAX (asynchronous call) to which this report was generated, and while this process does not answer me back I hide the button and show the "loading" and so has the return button I show and hide the "loading".
But I'm having problems in two different trials:
In the first attempt (code 1) with jQuery behavior of the button and the loading are expected but my PDF file that returns the function (data) below does not open in browser download window:
var url = "generateReport.do?action=print¶m1=param1";
//It only works when my page returns the html message "Empty report"