PDA

View Full Version : Ext.Ajax.abort not working



jiindal1988
29 Nov 2011, 11:32 PM
Hello, I have created 3 buttons in my application. On click of each button ajax request is send.

I want, as soon as user clicks on button, previous ajax request get cancel. I am using Ext.Ajax.abort(
requestId);

but I am getting error "Uncaught TypeError: Cannot read property 'readyState' of undefined".

Code for the same is as follows:

function locationRequest(searchText)
{
// Ajax request to fetch locations data
requestId = Ext.Ajax.request({
url: '/json/locations',
timeout: 120000,
params: {
"root":'node'
},
success:function(msg)
{
// process on success
},
failure:function(msg)
{
console.log(msg);
}
});
}

Now onclick of another button I use:
Ext.Ajax.abort(requestId);

Any help is appreciated.

mitchellsimoens
30 Nov 2011, 11:24 AM
Have you tried the autoAbort config?

jiindal1988
30 Nov 2011, 9:34 PM
Do I need to set autoAbort property to true??


Ext.Ajax.request({
url: '/json/locations',
timeout: 120000,
autoAbort:true,
success:function(msg)
{
// process on success
},
failure:function(msg)
{
console.log(msg);
}
});

Something like this?

jiindal1988
2 Dec 2011, 6:03 AM
Anything by which I can Cancel/Abort pending Ajax requests????