Reputation: 937
I am new to grails. I am using grails 1.3.7, and spring security core plugin for security.
My Application has most of the ajax calls.
When session expired at that time my authAjax method sends 401 error code.
Now My question is how do i rediect user to login page when get error code 401.
Any help is greatly appriciated.
Thanks.
Upvotes: 0
Views: 1340
Reputation: 35951
Probably you need to make it on client side. If you're using jQuery for ajax, you can make something like:
$.ajax({
// your current ajax code
statusCode: {
401: function() {
window.location.href = '/youAppContext/login'
}
}
});
An you can also setup it for all jQuery ajax calls, by $.ajaxSetup
Upvotes: 2