0
Я хочу загрузить файл с помощью extjs 4.1.extjs 4.1 скачать xml файл с помощью ajax
Имя файла "wsnDataModel.xml".
Я судимый со всеми вещами, предложенных в других постах:
//function invoked clicking a button
DwDataModel : function(th, h, items) {
//direct method that build in file in the location calculated below with "certurl" (I've verified)
Utility.GetDataModel(function(e, z, x) {
if (z.message) {
//the server method should give an error message
Ext.create('AM.view.notification.toast', {
title : 'Error',
html : z.message,
isError : true
}).show();
} else {
// navigate to get data
var certurl = 'http://' + window.location.host
+ '/AdminConsole3/' + e;
Ext.Ajax.request({
method : 'GET',
url : 'http://' + window.location.host
+ '/AdminConsole3/' + e,
success : function(response, opts) {
//the following navigate and openthe file in the current browser page.
//I don't want to change the current browser page
//window.location.href = certurl;
//the same behaviour with
//document.location = certurl;
//and this don't work at all
window.open(certurl,'download');
},
failure : function(response, opts) {
console
.log('server-side failure with status code '
+ response.status);
console.log('tried to fetch ' + url);
}
}, this, [certurl]);
}
}, th);
}
«NAVIGATION» перенаправлять приложение (я не хочу, чтобы перенаправить приложение), как это:
и Мне хотелось скачать этот файл:
Я думаю, что это очень просто. Как это сделать?
спасибо
если я пытаюсь использовать другое расширение, например wsnDataModel.cvs с 'window.location.href = certurl;' браузер загружает файл, но с расширением xml не – Marco