【问题标题】:AJAX problem in Internet ExplorerInternet Explorer 中的 AJAX 问题
【发布时间】:2011-05-27 23:06:06
【问题描述】:

这在 FF、safari、chrome 和 opera 中运行良好,但在 IE 中不行。

错误码是403

 var datau = "trends.php%3Frastgele%3D33";
 $.ajax({
    type: "GET",    
    url: "loader.php?kk=1&page="+datau,     
    data: "",       
    cache: false,
    success: function (html) {
        $('#content').empty();                  
        $('#content').html(html);
    },
         error:function (xhr, ajaxOptions, thrownError){
         alert(xhr.status);
         alert(thrownError);
          } 
});

【问题讨论】:

  • 您的完整 HTTP 403 错误是什么? There are many 403 errors.
  • HTTP 403 意味着服务器认为请求正在请求它不应该(禁止)的东西。你能发布你的服务器日志吗?
  • [error] [client 115.64.xx.xx] 文件不存在:/home/sitename/public_html/403.shtml,referer:sitename.com/trends.php?rastgele=33 还有,115.64.xx.xx - - [ 27/May/2011:18:18:32 -0500]“GET /loader.php?kk=1&page=trends.php%3Frastgele%3D33 HTTP/1.1”403 9“sitename.com/trends.php?rastgele=33”“Mozilla/5.0(兼容; MSIE 9.0;Windows NT 6.1;WOW64;Trident/5.0)" 仅在 Internet Explorer 中发生
  • 使用绝对 URL 而不是相对 URL 有帮助吗? PS--如果您使用 Internet Explorer 导航到 sitename.com/trends.php?rastgele=33 会发生什么?
  • 为什么将查询字符串放在 URL 中,而不是像应有的那样使用 data 参数?

标签: jquery ajax internet-explorer


【解决方案1】:

您现在应该通过 url 传递 GET 变量。 推荐如下(不要做urlencode):

 $.ajax({
    type: "GET",    
    url: "loader.php",     
    data: {"kk": 1, "page": 'trends.php?rastgele=33'},       
    cache: false,
    success: function (html) {
        $('#content').empty();                  
        $('#content').html(html);
    },
         error:function (xhr, ajaxOptions, thrownError){
         alert(xhr.status);
         alert(thrownError);
          } 
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-21
    相关资源
    最近更新 更多