[eluser]millisami[/eluser]
I'm using prototype window for the login form.
This is the link that will create a model login window.
Code:
<a href="[removed]openModalDialog()">Click here to open a modal window</a>
function openModalDialog() {
debug($('modal_window_content'));
var win = new Window('modal_window', {className: "alphacube", title: "Login", width:500, height:300, zIndex:150, opacity:1, draggable:false, resizable: false});
win.setAjaxContent('user/loginajax');
win.setDestroyOnClose();
win.showCenter();
win.show(true);
}
If the login fails, the error message is shown in the same modal window.
But the problem is, when the login is successful and in the function loginajax() if I put the code
Code:
redirect("/dashboard");
the content of the dashboard is loaded in the same windows instead of loading in the main parent window.
To overcome this, what I did is, I returned a responseText 'successfull' and compared it as follow
Code:
if (req.responseText == 'successfull') {
Windows.focusedWindow.destroy();
location.href='/dashboard';
}
But I don't think to load it via javascript location.href is a feasible way.
So, is there any other way to redirect and load the dashboard page in the parent window from the controller function itself?
Thanks