473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Refresh page after download complete

1,584 Expert 1GB
Hey guys been a while since I needed your help.

I've got a reporting system (yes same old one) , one button runs the report and builds the html table into the page all nice with CSS, etc, the other button produces a CSV output. I set the header variables (content-type, etc...) so that the user gets the Open/Save/Cancel prompt instead of outputing the CSV data.

The problem:

Since some of these reports take a long time, When a button is clicked I display an ajax loader. It works fine in case of the display to screen button because the page is refreshed, but in case of the export, the dialogue is displayed to download the file and the ajax loader image is still spinning on page.

How can I forward the page after the CSV page is displayed? Since in this case the page is actually refreshed as well (goes to the page that outputs the CSV) but of course to the browser it doesn't "display" the URL and hence change the look of the page, instead it displays the dialog.

I'm not sure i'm explaining this right so let me know if you don't understand. Here's the two buttons:

Expand|Select|Wrap|Line Numbers
  1. ############## SOME OF MY JS FUNCTIONS ################
  5. function submitGlobalForm()
  6. {
  7.     document.forms[0].submit();
  9. }
  12. function changeURL(url)
  13. {
  14.     document.location = url;    
  15. }
  19. function toggleDisplay(docID,displayValue)
  20. {
  21.     if(document.getElementById(docID) != null)
  22.     {
  23.         document.getElementById(docID).style.display = displayValue;    
  24.     }    
  25. }
  27. ###### H T M L (minus containers, other elements, etc) #########
  29. <input type="submit" name="pageAction" id="runReportBtn" value="Run Report" class="btn" onclick="toggleDisplay('runBtnLoaderImage','block'); toggleDisplay('reportTable','none');toggleDisplay(this.id,'none')" disabled="disabled" />
  31. <img id="runBtnLoaderImage" class="noDisplay" src="images/loaderSmall.gif" alt="Loading..."/>
  35. <input type="submit" name="pageAction" id="exportCSVBtn" value="Export CSV" class="btn" onclick="toggleDisplay('exportBtnLoaderImage','block'); toggleDisplay('reportTable','none'); toggleDisplay(this.id,'none'); changeURL('report.php');" disabled="disabled" />
  37. <img id="exportBtnLoaderImage" class="noDisplay" src="images/loaderSmall.gif" alt="Loading..."/>
  40. //Note: Ignore the the &nbsp; in the elements, that's not in my code, don't know why it shows here. 
Thanks guys!

Oct 1 '08 #1
2 6481
David Laakso
397 Expert 256MB
Ask on the javascript / ajax board.
Oct 1 '08 #2
1,584 Expert 1GB
Ask on the javascript / ajax board.
Thanks, yeah I should have, I was sleepy and tired.

Can a moderator move it? That would be better than having it in both places.


Oct 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Steve | last post by:
Hi, I have a private website for 20 people that is similar to a web email client like hotmail. There are two frames, one on the left with links for "New", "History", "Todays" and a frame on the...
by: dan baker | last post by:
I have a page that gets loaded with a meta-refresh hardcoded so that a few things on the page get updated. its kind of a fake chat board. anyway, what I need to do is turn off the meta-refresh once...
by: Matt | last post by:
Is there a way to execute server code without doing a complete page refresh in .Net? I have an ASP page to convert that uses XMLHTTP and I'm wondering if I should continue to use it in ASPX or do...
by: ACaunter | last post by:
Hi all, I loop through a folder in my asp.net program and display all the images. included with all the images is 1 word document which gets downloaded.. i get the download dialog box to come up...
by: TS | last post by:
Im in a web page and call an asynchronous method in business class. the call back method is in the web page. When page processes, it runs thru code begins invoking the method then the page...
by: Harold Crump | last post by:
Greetings, I have a web application where the main window shows a list of records available for download. The user clicks on the download button, which posts the form to another ..php page,...
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
by: Chris Beall | last post by:
(I'm rather inexperienced with JavaScript; the failing page was cobbled together from multiple sources)... http://pages.prodigy.net/chris_beall/STL/Timeline.html If JavaScript is not present,...
by: shahidrasul | last post by:
i want to download a file which user select from gridview, downloading is completing without problem but after download i want to refresh my page because i do some changes in db . but when...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.