I'm implementing Mozilla's persona authentication (ie browserid). So, I have the following onLogin():

我正在实现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); 
      }
  });
}

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.

哪里有“alert(”do reload“)”我通常有一个window.location.reload()调用。问题是,尽管如此,我所有努力清除并且不使用浏览器缓存(Firefox),我的/webservice.php页面根本没有被调用。 ajax调用立即执行“success”函数(如果我在代码中留下“reload()”调用,它会使我的窗口重新加载一个戏剧性的循环)。我需要在/webservice.php调用中使用PHP会话ID,因此我将PHPSESSIONID cookie传递给页面。

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.

我清除了我的firefox缓存。我关闭了我的浏览器,我将'sFoolCache'变量添加到了url(而不是帖子),但它也没有用。我迷路了。

3 个解决方案

#1


0

Looks like there's problem with passing URL, Try passing Full URL:

看起来传递URL有问题,尝试传递完整网址:

function onLogin(pAssertion) {
var sPHPSessionID = $.cookies.get("PHPSESSID")+'';
var sFoolCache = new Date().getTime() + '' + Math.random();
$.ajax(
  {
    cache: false,
    type: 'POST',
    url: 'FullURL and QUuerystring',
    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); 
  }
});
}

更多相关文章

  1. 获取项目列表的更好方法:缓存序列化数据与数据库查询或其他?
  2. 如何在Safari浏览器中禁用Ajax缓存?
  3. IE 浏览器各个版本 JavaScript 支持情况一览表
  4. 我可以禁用“后退”按钮浏览器功能吗?
  5. 浏览器如何处理HTML元素上的无效/未指定的属性?
  6. JQuery纯前端导入Excel文件,兼容IE10及IE9版本以下浏览器处理方法
  7. 删除复制+粘贴的富文本格式? (跨浏览器)
  8. 如何执行浏览器内对比扩展/规范化?
  9. 浏览器环境下JavaScript脚本加载与执行探析之动态脚本与Ajax脚本

随机推荐

  1. Scrapy爬虫实战| 手把手教你使用CrawlSpid
  2. 520|解锁Python表白新姿势
  3. Android(安卓)Studio真机测试时生成的程
  4. Python办公自动化|批量处理文件,一学就会
  5. 想做疫情分析却没有数据?看这篇就够了
  6. Python办公自动化|光速对比并提取两份Word
  7. Selenium自动化|爬取公众号全部文章,就是这
  8. Python办公自动化|自动更新表格,告别繁琐
  9. 收藏| Scrapy框架各组件详细设置
  10. 迭代学习 重视复盘——我的PMP备考之路(下