PDA

View Full Version : Inconsistent Ajax request return behavior



dbassett74
17 Jul 2009, 6:56 AM
I'm not sure what's going on, but it seems in some instances, the Ext.Ajax.request returns an object. In other instances, it returns a number. This is wrecking havoc on the ability to successfully cancel a currently running request. According to the docs, it should return a number representing the transaction id. I can't quite figure out what is causing it to act this way. I'm trying to isolate the issue, but my app is rather large, but I can tell you that in each case, it is being called exactly the same way. Has anyone experienced this? Can someone shed some light on this?

21 Jul 2009, 8:11 AM
what do you mean by it 'Returns'? Can you elaborate on how you're setting your requests up?

dbassett74
21 Jul 2009, 9:02 AM
According to the docs, calling Ext.Ajax.request() should return a transaction id. However, as indicated previously, it doesn't always seem to be a transaction id, rather, it is an object, where I have to get object.tId to get the actual transaction id. I got this hint from another post. But again, it seems like it flips back and forth between an integer value and an object. The way I have it setup is:



var req = Ext.Ajax.request({
...
});


sometimes req is an integer value and sometimes it is an object. I don't understand why.

tryanDLS
21 Jul 2009, 9:37 AM
It returns a transaction Id, unless you pass a callback fn config in your request call. Then it returns whatever your callback returned.