PDA

View Full Version : Logout Redirect in Controller



rich9285
4 Dec 2012, 3:21 PM
Hi All,

I have a button for the user to logout and should redirect to the login page. I have a logout.jsp file that handles the redirect. How do I call the file in my controller? I posted my controller code below.

Ext.define('UI.controller.LogoutController', {
extend : 'Ext.app.Controller',

views : ['HomePageHeader'],

init : function() {
console.log('INFO : Logout controller initiated');
this.control({
'menu component[action=logoutClick]' : {
click : this.onLogoutClick,

}
});
},

onLogoutClick : function() {
Ext.Ajax.request({
url: 'portalUI/logout.jsp'

})

}


})


Thanks in advance.

slemmon
4 Dec 2012, 10:07 PM
See if this works for you



onLogoutClick: function () {
window.location = 'portalUI/logout.jsp'; //redirects to url
}

rich9285
5 Dec 2012, 9:59 AM
It worked. Thank you very much