473,473 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

new window with php header via ajax, is it possible?

130 New Member
hello all

i am trying to create an excel report file to download
i have saw few examples in this site and work with them,

this is whats going on:

main.php have a form that the user choose date to extract his report,
then with ajax i return the table affter being generated from mysql.

the code that i echo to the ajax request is a <table> tag.

the problem is that affter i echo the table i also want to echo the excel,

Expand|Select|Wrap|Line Numbers
  1. if($xls_file=="1"){//if the user want excel file aswell 
  2.     $xlsxls = header("Content-type: application/msexcel");
  3.     $xlsxls .= header("Content-Disposition: attachment; filename=xldoc.xls");
  4.     $xlsxls .= $final;//thats the <table> that ajax echo
  5.     echo $xlsxls;
  6. }
this just produce the same table twice, is there a way to tell ajax to open it in a new window i belive that will solve it.

is there other solution?
Apr 22 '08 #1
1 1824
acoder
16,027 Recognized Expert Moderator MVP
Try using an iframe to force the download.
Apr 23 '08 #2

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

Similar topics

6
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This...
31
by: Benno Bös | last post by:
If I use the following construct in the frame "main" for a link to an extern site: <A HREF="http://www.any.xy" TARGET="extern"> the Browser is creating the window "extern", loading the page...
6
by: Charlie Garrett-Jones | last post by:
i have a server side generated web application that provides parameter forms and always opens the associated reports in a new browser window. the code that controls the opening of the new browser...
11
by: whisher | last post by:
Hi. Sorry to disturb you but I can't figure out its use in this snippet (Found in many scripts about Ajax) function loadpage(page_request, containerid) { if (page_request.readyState == 4 &&...
5
by: Sommer.pde | last post by:
It took me some time to find out when and why this happens. When the window of Internet Explorer is closed with an AJAX call still pending, something funny happens. Do it twice, and you will have...
3
by: jaynick | last post by:
Hello, everyone! I'm hoping that someone in this forum will be kind enough to help me out. I am having a Javascript issue related to Ajax and I just can't seem to figure it out. I am currently...
1
by: soms2m | last post by:
HELLO ALL, I want to fill the parent window height with respect to the sub window height which is loading using ajax (mootools). For example if the parent window height is normal and the loading...
6
by: SAL | last post by:
Hi, VS2005 post I'm opening a window using the following syntax: Protected Sub lbEstValue_Click(ByVal sender As Object, ByVal e As System.EventArgs)...
5
by: aelred | last post by:
I have a web page where a member can open up a chat window (child window) with another member. - From there the member can also navigate to other web pages. - From other pages in the site, they...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.