By: Bruno
Date: 2017-01-31
Time: 17:45
|
ExtSJ4, Ajax & Php. The browser don't propose me the document but the result is ok?
Dear All,
I try to use the demo inside my ExtJS program. I use a Ajax request to reach my php page.
Ext.Ajax.request({
url : 'onetest.php',
method : 'GET',
params: {
pn : 'xxxx'
},
success : function(){
Ext.example.msg('Information', 'Your Word document is ready');
},
failure : function(){
alert('Error');
}
All works fine if I call directly the PHP page, my browser propose me the docx document,
but if I call my php page in a Ajax request, I reach it, and the result is not "translate" (I don't know how can I tell that)
With the chrome developper tool I see the result like this:
PK!kÖñק _[Content_Types].xml ¢( ´UËnÂ0¼Wê?D¾VÄÐCUU$ú8¶H¥`ì
X²×ßw ª($K¤ÄÚÙÙñf8Z2YBÚÙ
Ò>KÀJ§´eìkòÖ{dIDa(
m ²Q~{3l<ĪmÌØÑ?qå©ó`é¤pÁ¤×0ã^Èo1~ßï?pé,ÅV,~ $cð]âá+/CëbJp,yÞÖUÔÞZ
$á|iÕ iÏ
\¢J+8©5S¦
ô]ÍóábQbòº&m[;¼jS5Q}?^ %:wƤTY
I try to add header('xxx'); text before the TBS->show without success
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment;filename="' . $fileName . '"');
Do you have an idea about this problem ?
Thanks a lot for your help,
Sincerely,
Bruno
|
By: Skrol29
Date: 2017-02-02
Time: 20:21
|
Re: ExtSJ4, Ajax & Php. The browser don't propose me the document but the result is ok?
Hello Bruno,
The problem is not OpenTBS but the way you're try to get the document.
Ajax does HttpRequest calls that produce a result which is catchable only by Javascript. You cannot have a download from the navigator as a result of an Ajax call.
You can have your download from your page only by calling the link directy.
|
By: Bruno
Date: 2017-02-03
Time: 08:54
|
Re: ExtSJ4, Ajax & Php. The browser don't propose me the document but the result is ok?
Hi Skrol29,
Thank you for your answer, I will investigate right now to find a solution in my Ajax answer.
Have a nice day,
Bruno
|