Categories > OpenTBS with ODT >

problem with AJAX

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: william
Date: 2010-06-25
Time: 15:42

problem with AJAX

I am trying to create an OO document from a script that is invoked via AJAX.
When running stand-alone, it works fine.  When invoked via AJAX some output ends up in the DIV and no document is created.  The stuff in the DIV starts with:
PK&#65533;&#65533;&#65533;&#65533;"X&#65533;<^&#65533;2 '&#65533;&#65533;&#65533;'&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;mimetypeapplication/vnd.oasis.opendocument.textPK&#65533;&#65533;
and ends with
Configurations2/toolbar/PK &#65533;&#65533;&#65533;&#65533;&#65533;"X&#65533;<&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; &#65533;&#65533;Configurations2/images/Bitmaps/PK &#65533;&#65533;&#65533;"X&#65533;<&#65533;J}&#309;&#65533;&#65533;)T&#65533;&#65533; &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;content.xmlPK &#65533;&#65533;&#65533;&#65533;"X&#65533;<&#65533;&#65533;O&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; &#65533;&#65533;manifest.rdfPK &#65533;&#65533;&#65533;"X&#65533;<&#907;&#65533;d@ &#65533;&#65533;5&#65533;&#65533; &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;) &#65533;&#65533;styles.xmlPK &#65533;&#65533;&#65533;&#65533;&#65533;"X&#65533;<&#65533;.J&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;meta.xmlPK &#65533;&#65533;&#65533;"X&#65533;<&#65533;p&#65533;U &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;.&#65533;&#65533;META-INF/manifest.xmlPK&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;(&#65533;&#65533;_0&#65533;&#65533;&#65533;&#65533;

Anyone have any thoughts or suggestions ?
I am puzzled.

bill
By: william
Date: 2010-06-25
Time: 15:48

Re: problem with AJAX

Addendum:
After merging I show with this statement:

$file_name = "test.odt";

// Output as a download file (some automatic fields are merged here)
$TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, $file_name);

bill
By: Skrol29
Date: 2010-06-25
Time: 17:13

Re: problem with AJAX

Hi Bill,

When you do an HTTP download, an HTTP header is send before the binary contents in order to info the bowser that the arriving content is a download. But when you are using the Ajax functions, the HTTP header is superfluous, only the content is transfered. And that what Ajax is for.

So I don't believe you'll succeed in perform an HTTP download with Ajax.
By: william
Date: 2010-06-25
Time: 21:03

Re: problem with AJAX

Thanks, I fear you are correct, but I was hoping there was some magic.
I guess I will just pop open a new window instead of using AJAX for this function.

I continue to appreciate the rapid responses with the help and love TBS.

bill