2012-11-04 26 views
2

所以我做了一個非常基本的Ajax請求,但我不能讓它在Chrome非阻塞。這個請求有什麼問題嗎? IE可以很好地處理它,但是鉻可以完全凍結幾秒鐘。 chrome停止凍結後,超時事件被觸發。異步AJAX請求瓦特/ jQuery的凍結鉻

setTimeout(this.onExtendedSaveTimeCallback, 1000); 

    this.isSaving = true; 
    this.request = $.ajax({ 
     url:  'http://same-origin.com', 
     type:  'POST', 
     dataType: 'html', 
     data:  data, 
     async:  true, 
    }); 

    this.request.done(function(response) { 
     self.isSaving = false; 
     self.$rootElement.find('.save').removeClass('saving'); 
     if(response != "SUCCESS") 
     { 
      // The input did not pass validation 
      // Show the error message 
      self.$rootElement.find('.edit-mode-content').prepend(response); 
      self.$rootElement.find('.error').slideDown(200); 
      self.$rootElement.find('.save').html('Spara'); 
      self.unblockRowInput(); 
     } 
     else 
      self.close(true); 
    }); 

回答

2

我不認爲它的ajax調用。我見過類似的情況,當瀏覽器窒息時,創建ajax數據參數很昂貴。根據你如何進行循環/遍歷,性能可以改變很多跨瀏覽器。要驗證,請嘗試提交ajax請求,而不要執行創建數據參數的工作。

0

你有一個逗號後async: true, ......是故意的嗎?