我正在实现 Mozilla 的角色身份验证(即 browserid)。所以,我有以下 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);
}
});
}
在哪里有“alert(“do reload”)”我通常有一个 window.location.reload() 调用。问题是,尽管我努力清除而不使用浏览器缓存 (Firefox),但我的 /webservice.php 页面根本没有被调用。ajax 调用立即执行“成功”函数(如果我将“reload()”调用留在代码中,这会使我的窗口重新加载在一个戏剧性的循环中)。我需要 /webservice.php 调用中的 PHP 会话 ID,因此我将 PHPSESSIONID cookie 传递给页面。
我清除了我的 Firefox 缓存。我关闭了浏览器,将 'sFoolCache' 变量添加到 url(而不是帖子),但它也不起作用。我迷路了。