I'm implementing Mozilla's persona authentication (ie browserid). So, I have the following onLogin():
function onLogin(pAssertion) {
var sPHPSessionID = $.cookies.get("PHPSESSID")+'';
var sFoolCache = new Date().getTime() + '' + Math.random();
$.ajax(
{
cache: false,
type: 'POST',
url: '/webservice.php?id=personaauth&u=i',
data: { assertion: pAssertion, PHPSESSID: sPHPSessionID, z: sFoolCache },
success: function(res, status, xhr) { alert("do reload"); },
error: function(xhr, status, err) {
navigator.id.logout();
alert("Login failure: " + err);
}
});
}
Where there's the "alert("do reload")" I normally have a window.location.reload() call. The problem is that, nonetheless all my efforts to clear and not use the browser cache (Firefox), my /webservice.php page doesn't get called, at all. The ajax call immediately executes the "success" function (which keeps my window reloading in a dramatic loop, if I leave the "reload()" call in the code). I need the PHP session id in my /webservice.php call, so I pass the PHPSESSIONID cookie to the page.
I cleared my firefox cache. I closed my browser, I added the 'sFoolCache' variable to the url (and not the post) but it didn't work either. I'm lost.
As it appeared to help in this case, I'm undeleting this answer
Check here: http://api.jquery.com/jquery.ajax/
Use this instead: