I've got a bit of code that runs like this... User logins in Site A $.ajax sends the data to Site B Site B authenticates, sets cookies and returns a 1 char flag Site A then reloads to the exact same page @PoPSiCLe - I saw your other post about reloads but there are too many settings dependent on the login/logout and a complete reload would be cleaner. Now, that is all good but something is coming unstuck. If I stop at #3 and manually reload the page the login/logout will have worked If I automatically reload (#4) the remote script won't have run. When I watch the "network" tab on Chrome's inspect panel and have my finger hovering on the printscreen button I can see this in the image I get that a reload would cancel an ajax call but it's in the callback so surely that should be running after there is a response from the remote script? Edit: complete seems ok, so I'll use that. Confusing though.
Uhm ... if you are reloading on login, why are you wasting time with AJAX crap? Though if that's actually two separate sites, shouldn't that NOT work since that would be a cross site execution?
My guess (as you haven't posted any code), is that your refresh is called inline with the ajax (Asynchronous JavaScript and XML) which runs separately to the execution of your code flow. Change $.ajax('siteb/login') //refresh code here HTML: to $.ajax('siteb/login').done(function() { //refresh code here }); HTML: this will ensure that the request is complete before you kill all requests and refresh page. Whilst I answered your question to fix what you have I would have to agree with deathshadow why not use a standard post and do the following. User logins in Site A Site A Server then sends request to SiteB which authenticates and returns Page Comes back all logged in and happy.