Welcome Guest, Not a member yet? Register   Sign In
Login in redirect via AJAX request
#1

[eluser]Base Willy[/eluser]
Hi!
I have a problem with logging in and then redirecting via ajax request which is made by Prototype.js Ajax.Updater.
If login success I try to redirect via redirect() function, but it makes so that the page loads in the area where ajax request result is shown, not redirects the browser. So i try to redirect via javascript [removed].href='...' and then I have another problem - cacheSmile After redirect browser loads the page from cache and it looks like you didn't log in.

Need some helpSmile

ps: Using OB Session.
#2

[eluser]Base Willy[/eluser]
Guuuys I really need help Sad
#3

[eluser]Pygon[/eluser]
http://ellislab.com/forums/viewthread/63962/ covers preventing page caching.

redirect() will not work correctly in your case.
#4

[eluser]kylehase[/eluser]
ajax updater is designed to reload a div only so any response will only affect that div.

I had the same problem. Check out this page for a good solution.
http://forums.devshed.com/javascript-dev...46837.html

It basically outlines two steps.

1) add an onComplete line to your ajax updater
Code:
var ajax = new Ajax.Updater(
         'login_div',        // DIV id
         'login.php',        // URL
         {                // options
         method:'post',
             onComplete: checkLogin
         }
);
2) Have your onComplete function check the updated response
Code:
function checkLogin(response)
{
    if (response == "Success!") {
        [removed]='welcome.php';
    }
}
#5

[eluser]Base Willy[/eluser]
linuxamp, thanks for your hint but it doesn't solve the problem, sometimes in IE and Opera the page loads from cache and it's like you didn't login Sad I've added no-cache headers to the view but even this doesn't help




Theme © iAndrew 2016 - Forum software by © MyBB