jquery $ .ajax请求在IE 11中保持挂起状态,适用于chrome和firefox

时间:2016-08-26 20:02:58

标签: javascript jquery ajax spring-mvc internet-explorer

我正在尝试下载一个excel文件,问题是它在IE 11中无法正常工作。它在chrome和firefox上运行正常但是当我在IE上运行它时我得到了待处理的请求而且它没有#t离开:enter image description here

以下是我的ajax调用的代码:

$('#partTable').dataTable( {
  "processing": true,
  "serverSide": true,
  "pageLength": 50,
  "bSort" : true, 
  "order": [],
  "language": {
      "lengthMenu": ""
  },
  "ajax": {
      cache: false, 
      url: $('#url').val(),
      type: "POST",
      data: function (d) {
          //("in data function");

                 if( $('#filter0').val() !=''){
                         d.columns[0]['search']['regex'] = true;
                         d.columns[0]['search']['value'] = $('#filter0').val();
                         $('#pageHeaderL2').html("<button class='myButton' style='cursor:default;' type='button' name='" +  $('#filter0').val() + "'>" + $('#filter0').val() + "</button>");
                         //("set default facility");
                 }
                 if( $('#filter1').val() !=''){
                         d.columns[1]['search']['regex'] = true;
                         d.columns[1]['search']['value'] = $('#filter1').val();
                         $('#pageHeaderL5').html("<button class='myButton' style='cursor:default;' type='button' name='" +  $('#filter0').val() + ":" + $('#filter1').val() + "'>" + $('#filter0').val() + ":" + $('#filter1').val()  + "</button>");
                         //("set default module");
                 }


                 if($('#searchValueIn').val() != "")// depending on if you module search or global search the search string is stored in a different location, this saves the search val in a string
                    var searchVal = $('#searchValueIn').val();
                 else
                    var searchVal = $('#searchValueLocal').val();

         var dd = $.extend({}, d, {
          "originalSearchValue": searchVal
          //"useDefaultFacility": $('#filter0').val() !='' ? true : false,
          //"useDefaultModule": $('#filter1').val() !='' ? true : false,
                    });

         currentTableMeta = dd;

         return dd;
      },
      dataSrc: function(json) {
             for ( var i=0, ien=json.data.length ; i<ien ; i++ ) {
                 json.data[i][0] = '<a href="/message/'+json.data[i][0]+'>View message</a>';
                 }

          if($('#searchValueIn').val() != "")
              var searchVal = $('#searchValueIn').val();
          else
              var searchVal = $('#searchValueLocal').val();

         var hrefExcel= $('#excelurl').val() +'?searchValue='+ searchVal +'&' +  $.param(currentTableMeta) ;
         // debugger;

          if($('#tableExcel').length < 1) {
              $('#partTable_filter').css({left: 10, position:'absolute'});
              $('#partTable_filter').prepend($('<a id="tableExcel" href="' + hrefExcel + '" class="btn" style="float:right; margin-left: 5px;"><i class="icon-table"></i> Excel</a>'));
                /* $('#tableExcel').on("click",function(e) {
                  //var abc = $(currentTableMeta).serialize();
                  var abc = $.param(currentTableMeta);
                  debugger;                });  */
                 // alert("in the IF");
            $('#partTable_processing').before("<br /><br />");
          }else{
            $("#tableExcel").attr('href',hrefExcel);
            //alert("in the else");   
            alert("After the Click");
          }
          tableSortRowObj = $("#sortRowState");


          //("this current sort:" + tableSortRowObj);

          updateFilterFields(json);
          //("to isnert:" + newRowOfFilters);


          return json.data;
      }
  },
  "fnDrawCallback": function( oSettings ) {
      //( 'DataTables has redrawn the table' );

      if(!tableLoadedOnce){
          $('#partTable > tbody').prepend('<tr id="sortRowState">' + newRowOfFilters +'</tr>');
      }
      else{
            //("add this value:" + tableSortRowObj);

            $('#partTable > tbody').prepend(tableSortRowObj);
            var emptyRows = $('#partTable > tbody > tr > td.dataTables_empty');

           // ("this size:" + emptyRows.size());

           if(emptyRows.size() > 1){
                  emptyRows.eq(1).remove(); 
           }
      }

  $('#col0Filter > select').prop("disabled",false);
  $('#col1Filter > select').prop("disabled",false);
  $('#col6Filter > select').prop("disabled",false);

      tableLoadedOnce=true;

      //("about to hightlight");
      //collect all the words to highlight across current filters
      //$("#partTable").highlight("spider");
      //$("#partTable").highlight("valve");
      $.each( highlightMap, function( key, val ) {
            $.each(val.split(" "),function(index, value){
                   $("#partTable").highlight(value);                      
            });
            });
    },


  "columns": [
      { "data": "facility", "bVisible": false},  
      { "data": "module", "bVisible": false},  
      { "data": "partIdView","width": "60px"},
      { "data": "currentLocation", "width" : "160px"},
      { "data": "classification","width": "110px"},
      { "data": "partType", "width": "130px"},
      { "data": "serial", "width": "130px"},
      { "data": "status","width": "110px"},
      { "data": "quantity","width": "40px"},
      { "data": "oemopm", "width": "200px"},
      { "data": "tiIdentification", "width": "120px"},
      { "data": "poNumber", "width": "120px"},
      { "data": "description", "width": "160px"},
      { "data": "altDescription", "width": "160px"},
      { "data": "toolModel","width": "110px"},
      <c:if test="${currentModule.freeTradeZone }"> 
      { "data": "cdfNumber","width": "180px"},
       </c:if>
      { "data": "shortText","width": "110px"},
       { "data": "toolModel","width": "140px","bVisible":false},
       { "data": "partCheckout","width": "140px","visible":false}
  ] });

我的服务器也出现以下错误:

Aug 16, 2016 12:16:20 PM org.apache.coyote.http11.AbstractHttp11Processor process INFO: Error parsing HTTP request header

任何帮助将不胜感激。谢谢。

0 个答案:

没有答案