Welcome Guest, Not a member yet? Register   Sign In
Problem in login system while using Ajax
#9

[eluser]FutureKing[/eluser]
[quote author="n0xie" date="1254582846"]Your problem has nothing to do with authentication. Because you use AJAX, whenever you load part of your page and that part is not user authenticated, you will get a redirect from the server which return the login screen to your ajax call. So it's doing exactly as you told it to do : validate if the user is authenticated. If not redirect to login screen.

This is not a problem you can fix, it's inherent to the way you setup your site.

The only solution I can think of is if you pass a message via ajax which says 'user logged out' or something simular and your page does a javascript redirect to a login page. This works, but is ugly from my point of view, but should 'fix' your problem.[/quote]

Correct!
You understood my problem. Great.

I also thought about this. jQuery has Ajax events like $.ajaxStart(),$.ajaxStop() etc. I also thought to use them. Now this creates another problem.

This is what I thought:
While using application everytime user clicks on buttons/controls etc and fires an Ajax request. Now with help of jQuery ajax events another ajax request fires which checks whether the user is logged in or not. If user is not logged in then it redirects the user.

Problem is, creating an ajax request inside jQuery ajax events creates recursion.

Do you have any way to stop such type of recursion.

$.ajaxStart(function(){
$.ajax({
param1:
param2:
...etc...
success:function(){
}
});
});


Messages In This Thread
Problem in login system while using Ajax - by El Forum - 10-02-2009, 10:14 AM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 04:20 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 06:00 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 06:47 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 07:10 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 07:30 PM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 01:25 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 04:14 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 04:58 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 05:39 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 05:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB