I have some php that checks if a user is logged in and returns false, this is then passed via ajax to the browser to let the user know he needs to log in.
Works perfect in FF and the alert returns ‘true’ but in IE, it returns ‘null‘ no matter what I do
// Check for logged in user
$.getJSON(baseUrl+"index.php/login/checkState", function(data) {
alert(data);
if(data==true){
dologInState();
}else{
dologOutState();
}
});
PS: the string returned from PHP is simply false
Any ideas?
I eventually managed to sort this out. The problem was not the ajax call to begin with.
It was that the ajax calls were getting its true and false values from php doing a simple “is the authentication cookie present” check.
I cant tell you how or why this was working in FF and acting up in IE and it could have been something I did – but – since 90% of the application is built out of js and ajax calls the solution was to handle all cookie checks with Java script and not with PHP at all.
Ive even got the cookie to store json strings now, its beautiful.
Thanks for all the help guys, much appreciated.