Finally found out the culprit and solved the problem 🙂 IE caches AJAX requests. So whenever you use AJAX call to set login cookies, you are in for a trouble in IE. Beware!!!!! In your ajax call fill in a random number in the URL so that IE wont catch
In the Ajax call inserted this
var d = new Date();
var n = d.getTime();
req.open("GET", "something.php?user"+username+"&x="+n);
By doing this IE wont cache the AJAX request