473,320 Members | 1,902 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,320 software developers and data experts.

refresh page problem

2
Hey,

I'm generating on-the-fly reports, and each report is displayed with a link "Export to excel". Every time this link is clicked, I use Ajax to export the data in the report's table and save it as a file (report.xls), then I use window.location = "report.xls" to force the user to open or save the report in excel format.

The report that's created on the server with the click is always accurate, but the one that the user can open/save is always a few reports old.

I figured it was a caching problem so I added the headers like:
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: max-age=0');
header('Cache-Control: no-store, no-cache, must-revalidate');

I also changed from window.location="report.xls" to document.location.href="report.xls". But no change.

Any ideas?
Apr 9 '08 #1
3 1259
acoder
16,027 Expert Mod 8TB
Welcome to bytes.com!

Try adding an extra parameter when accessing the Excel file, e.g.
Expand|Select|Wrap|Line Numbers
  1. window.location.href = "report.xls?d="+new Date().getTime();
Apr 9 '08 #2
asaaki
2
Brilliant! Thank you!! :D
Apr 10 '08 #3
acoder
16,027 Expert Mod 8TB
You're welcome. Glad to help!
Apr 10 '08 #4

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

Similar topics

6
by: Rick | last post by:
Hi folks, I have a web page I wrote for a class assignment (which I embellished a little) that doesn't seem to work on all browsers, platforms, etc. The problem appears to be that the page...
3
by: Scott | last post by:
I have a clickable graph that resides on page 1. If user clicks a data point on the graph, the page runs again yeilding a 2nd graph that shows a more detailed graph. Problem is, I have a...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
4
by: wright | last post by:
hello, i have a problem in refreshing a page. the problem happens when i click a button that does a certain action in a web page, such as inserting a record into the database, if now i refresh the...
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
1
by: francois | last post by:
I have a ASPX form with a dropdownlist that makes a post back (to the same page of course, just a normal asp.net postback) That page also has an auto refresh javascript as it needs to refresh its...
1
by: ppatel | last post by:
Problem I have a problem with web image button control click event. The click event does not get trigger until it has not been clicked once or page refresh occures(which is fine). When click...
8
by: Judy Ward | last post by:
I have an index.aspx with frames. The top frame has a navigation bar with a "Login" hyperlink. If the user has already logged in I want this link to change to "Logout". I am using forms-based...
2
by: Just D. | last post by:
All, How should we refresh the current aspx frame? I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.NoCache); but it didn't help. The...
9
by: Mr Newbie | last post by:
Before someone flames me, I know this is the VB.NET groups, nonetheless, the asp.net guys seems to have almost disapeared from the aspnet groups so I thought I would ask this here. I have a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.