Hi,

I want to use wicketGlobalFailureHandler() to handle some http status codes 
from an Ajax-Call.

Currently I am doing something like this - which works fine - but is in my 
opinion not very nice.

function wicketGlobalFailureHandler() {
        var t = Wicket.Ajax.transports;
        for (var i = 0; i < t.length; ++i) {
                if (t[i].readyState == 4) {
                        var status = t[i].status; 
                        if (status == '401') {
                                alert('Do something...');
                        }
                        if (status == '403') {
                                alert('Do another thing...');
                        }
                }
        }
}

Is there a better way, instead of getting all transports and then checking 
readyState and status code? 
Is there a possibility to get only the current transport, which triggered the 
failure handler?

Or maybe I'm doing something completely wrong and there is a better approach 
how I can handle these cases...

Regards

Thorsten

Reply via email to