nanotron
27 Aug 2008, 6:31 AM
Hi all,
sometimes I need to make ajax-requests on IE6 with deactivated Active-X.
So I wrote this little overwrite which utilize the file-upload-functionality:
var xhr = Ext.lib.Ajax.getConnectionObject();
if(!xhr){
MyAjax = function(o) {
Ext.apply(this);
this.method = this.method || 'POST';
MyAjax.superclass.constructor.call(this);
if (this.success) {
this.on('requestcomplete', this.success);
}
if (this.failure) {
this.on('requestfailed', this.failure);
}
};
Ext.extend(MyAjax, Ext.data.Connection, {
request : function(o){
if(!o.params)
o.params = 'ajax=1';
else if(typeof o.params == 'object')
o.params.ajax = '1';
else
o.params += '&ajax=1';
if(!o.form)
o.form = "dummyForm";
if(!o.isUpload)
o.isUpload = true;
o.async = o.async || false;
MyAjax.superclass.request.call(this, o);
}
});
Ext.Ajax = new MyAjax();
}
A form with id="dummyForm" must be present in the html-file.
Unfortunately it doesnt work with hendricd's basex-extension.
Maybe it will help somebody.
Cheers
sometimes I need to make ajax-requests on IE6 with deactivated Active-X.
So I wrote this little overwrite which utilize the file-upload-functionality:
var xhr = Ext.lib.Ajax.getConnectionObject();
if(!xhr){
MyAjax = function(o) {
Ext.apply(this);
this.method = this.method || 'POST';
MyAjax.superclass.constructor.call(this);
if (this.success) {
this.on('requestcomplete', this.success);
}
if (this.failure) {
this.on('requestfailed', this.failure);
}
};
Ext.extend(MyAjax, Ext.data.Connection, {
request : function(o){
if(!o.params)
o.params = 'ajax=1';
else if(typeof o.params == 'object')
o.params.ajax = '1';
else
o.params += '&ajax=1';
if(!o.form)
o.form = "dummyForm";
if(!o.isUpload)
o.isUpload = true;
o.async = o.async || false;
MyAjax.superclass.request.call(this, o);
}
});
Ext.Ajax = new MyAjax();
}
A form with id="dummyForm" must be present in the html-file.
Unfortunately it doesnt work with hendricd's basex-extension.
Maybe it will help somebody.
Cheers