aspose file tools*
The moose likes Struts and the fly likes Open PDF file by AJAX holding the button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Open PDF file by AJAX holding the button" Watch "Open PDF file by AJAX holding the button" New topic
Author

Open PDF file by AJAX holding the button

James Thraloc
Greenhorn

Joined: Apr 30, 2012
Posts: 1
Hi,

Can you help me with the following problem?

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:



On the second try (code 2) using Dojo return the PDF file is expected but when the browser's download window opens lose control in order to enable the button again and disable image loading.


Is there any way to open this PDF file using jQuery or Dojo in control my DIVs?


Thank you,


HTML Fragment:



Code 1 (jQuery):



Code 2 (Dojo):



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open PDF file by AJAX holding the button