I haven't received an answer with my other post, so I am rephrasing it here.
In php I have a 2D array which I "print". The headers force it to be a
file on the user's system. The user receives a pop-up that asks him if
he wants to open it or save it. (Of course, he can simply cancel). The
file I send is in an Excel readable file. This works fine for simple
systems where the page is submitted and then the action is performed by php.
Now for the problem. Using AJAX I have a very complicated page being
displayed that takes a while to build. There are numerous buttons and
"links" on this page. They all operate via AJAX. One of those buttons
is to generate the Excel file. The problem is that if I direct the AJAX
target to a div on the screen, it simply prints and ignores the headers
from php to output to a file. If I don't buffer the output to send it
all at once, then the print statement is not understood by AJAX and I
get an error message about an illegal string.
How do change the AJAX target, and/or what else must I do, so that it
will operate the same as with simple web systems and generate a file and
a popup to the user?
In php I have a 2D array which I "print". The headers force it to be a
file on the user's system. The user receives a pop-up that asks him if
he wants to open it or save it. (Of course, he can simply cancel). The
file I send is in an Excel readable file. This works fine for simple
systems where the page is submitted and then the action is performed by php.
Now for the problem. Using AJAX I have a very complicated page being
displayed that takes a while to build. There are numerous buttons and
"links" on this page. They all operate via AJAX. One of those buttons
is to generate the Excel file. The problem is that if I direct the AJAX
target to a div on the screen, it simply prints and ignores the headers
from php to output to a file. If I don't buffer the output to send it
all at once, then the print statement is not understood by AJAX and I
get an error message about an illegal string.
How do change the AJAX target, and/or what else must I do, so that it
will operate the same as with simple web systems and generate a file and
a popup to the user?
Comment