[英]Extjs 3.4 - Ajax call being cancelled automatically
I have a PHP script the imports a large file into a DB. 我有一个将大文件导入数据库的PHP脚本。 When I execute the script directly, it completes without a problem.
当我直接执行脚本时,它可以顺利完成。 However, when I call the same script in my extjs app, it fails with:
transaction aborted
captured by the Ajax failure callback. 但是,当我在extjs应用程序中调用相同的脚本时,它失败并显示:由Ajax故障回调捕获的
transaction aborted
。
The Ajax request: Ajax请求:
Ext.Ajax.request({
url: projectparameters.service + 'importxxxxx.php',
scope: this,
method: "POST",
params: {
projectparameters: JSON.stringify(projectparameters),
ftpUrl: ftpUrl,
fileName: fileName,
fileDate: fileDate
},
success: function(response, rowIndex){
var feedback = JSON.parse(response.responseText);
if(feedback.success === false) {
Ext.Msg.alert('Error', feedback.msg);
}
else if( feedback.success === true ) {
Ext.Msg.alert('Success', feedback.msg);
// After uploading the file - reload import-history
var importHistoryTab = Ext.getCmp('grid_ImportHistory');
importHistoryTab.getStore().reload();
var featureGrid = Ext.getCmp("featuregrid");
featureGrid.getStore().reload();
}
},
failure: function(response, rowIndex){
console.log('response: ');
console.log(response);
Ext.Msg.alert('Error', 'File could not be imported - '+response.statusText+'.<br> Aborted: '+response.isAbort+'. <br>Timeout: '+response.isTimeout+'.');
}
});
This is what I can see in the network response: 这是我在网络响应中看到的:
This is the Ajax failure object 这是Ajax失败对象
I have already set the script execution to infinity in PHP, so I doubt PHP being the culprit, as I said, executing the script independantly from the frontend works... 我已经在PHP中将脚本执行设置为无穷大,所以我怀疑PHP是罪魁祸首,正如我所说的那样,它独立于前端工作而执行脚本...
So: Is this the ajax not being set up correctly? 那么:这是不是正确设置了ajax? How can I trace this?
我该如何追踪?
Any ideas? 有任何想法吗?
I cannot seem to figure this out or find any helpful advice. 我似乎无法弄清楚这一点,也找不到任何有用的建议。
The solution turned out to be quite simple: set the timeout
for the Ajax. 事实证明,该解决方案非常简单:设置Ajax的
timeout
。
I just had to increase it to allow the script to finish. 我只需要增加它以允许脚本完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.