【问题标题】:Internet Explorer causes an Invalid Authenticity Token errorInternet Explorer 导致 Invalid Authenticity Token 错误
【发布时间】:2011-09-27 15:32:39
【问题描述】:

这适用于除 IE7 和 IE8(可能还有 IE6)之外的所有浏览器。

由于某种原因,它不会尊重我的真实性令牌。

有什么想法、调试技巧、解决方法吗?

我的标准设置:

$(document).ajaxSend(function(event, request, settings) {
    if ( settings.type != 'GET' ) {
        settings.data = (settings.data ? settings.data + "&" : "")
            + "authenticity_token=" + encodeURIComponent( AUTH_TOKEN );
    }
});

我的 AJAX 调用:

$(".ajax-referral").click(function(){
  $.ajax({
      type: "POST", 
      url: $(this).parent("form").attr("action"), 
      data:$(this).parent("form").serialize(),
      dataType: "script",
      });
  return false;
});

【问题讨论】:

    标签: jquery ruby-on-rails ajax internet-explorer authenticity-token


    【解决方案1】:

    此错误是通过 Mac OSX 在 Parallels 中使用 IETester 引起的。 IETester 在其会话中不持有 Authenticity Tokens。

    【讨论】:

      猜你喜欢
      • 2013-02-20
      • 1970-01-01
      • 1970-01-01
      • 2015-05-16
      • 1970-01-01
      • 1970-01-01
      • 2013-11-24
      • 2012-05-30
      相关资源
      最近更新 更多