Andreas Delmelle wrote:
On 13 Nov 2008, at 19:38, Sheldon Glickler wrote:
Hi
<snip />
I use php code to generate the xml file. This php is invoked via an
AJAX call. After the xml file is generated I use the php command
exec(the_command_string_for_running_the_php);
How is the setup precisely? Since mixing client- and server-side
scripting is always a bit tricky, I just want to make sure I understand
correctly
If all is well, I'm guessing it looks a little like:
1° launch asynchronous request and return (client-side, Javascript)
2° generate the XML and send a response, indicating that it's ready to
be converted (server-side, PHP)
3° handle the response, by sending a second request, and return
(client-side, Javascript)
4° handle the second request, and send a response when complete
(server-side, PHP; your 'exec();' statement)
5° handle the new response, which could be something like setting the
'src' attribute of an IFRAME to the location where the PDF was generated
(client-side, Javascript)
Not nearly that complicated. There is only one AJAX call.
The browser is displaying a particular page (which was obtained via the
AJAX route and filling in the template). On that page are various
fields, one of which is a button to create the pdf. Clicking that
button invokes a javascript that picks a few values off the page and
does the AJAX call. The php script invoked does the following:
1 - gather data from the database
2 - build the xml file, writing it in a particular folder
3 - invokes an exec command for the fop to build the pdf
It then returns, changing an innerHTML of a tag to indicate that the pdf
file is in place -- but NOT do display the pdf.
All the work is done server side. The exec call is synchronous with,
and immediately after, the successful writing of the xml file.
Where step 3° (5° resp.) corresponds to the AJAX onreadystatechange()
handler attached to the request sent in step 1° (3° resp.).
When I do that, I get the error message "invalid flag after regular
expression". I posted to the php and javascript newsgroups, but they
said that it was probably from the fop.
Well, if you'll allow me to bounce back:
The error has nothing to do with FOP. It is an error raised by the
browser, pointing to invalid Javascript embedded in HTML. In the
nastiest case, it could simply be a silly missing quote somewhere in the
generated HTML... :/
I looked at this last paragraph of yours and starting thinking. I was
seeing that message in Firebug. I also saw there what the entire
command string was. That was from a print statement. When I removed
that print statement, the error message disappeared.
Now I am left with wondering why the exec command didn't create the pdf
-- but that is a different problem.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]