how to add beforerequest and requestcomplete event to specific ajax request in Extjs4?
Regards
Ext.Ajax.on("beforerequest", function(){
console.info("beforerequest");
});
Ext.Ajax.on("requestcomplete", function(){
console.info("requestcomplete");
});
Ext.Ajax.request({
url: 'get-nodes.php',
success: function(response){
var text = response.responseText;
console.info("response");
}
});
or if you need it in specific cases, try this :
Ext.define('myAjax', {
extend: 'Ext.data.Connection',
singleton: true,
constructor : function(config){
this.callParent([config]);
this.on("beforerequest", function(){
console.info("beforerequest");
});
this.on("requestcomplete", function(){
console.info("requestcomplete");
});
}
});
myAjax.request({
url: 'get-nodes.php',
success: function(response){
console.info("response");
}
});