PDA

View Full Version : Ajax - Request Complete



jakehawk
16 Aug 2007, 11:14 AM
Here is my idea. If the user is not logged in or does not have permissions to do something, I would have a json response containing errors and such. I do not wish to check it before I call every single Ajax call (trees, grids, tab panel update, etc), so I thought I could use:

Ext.Ajax.on("requestcomplete", fuction() { Ext.MessageBox.alert("test", "request completed"); } );

But this runs after giving the response to the appropriate function. What I would like to do is intercept the response immediately after it returns, check for a json key, and then pass it on the appropriate function after verifying login or whatever.

How should I go about this?

Thanks!

jakehawk
16 Aug 2007, 11:21 AM
I lied!

After checking the Ext source, I saw what I was doing wrong. Using the above code works correctly.