AJAX problem in Internet Explorer

2019-07-08 03:28发布

问题:

This works in FF,safari,chrome and opera very well, but doesn't in IE.

The error code is 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);
          } 
});

回答1:

You should now pass GET variables by url. The following is recommended (don't do 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);
          } 
});