Reputation: 1160
So I'm doing a pretty basic ajax request, but I can't make it non-blocking in chrome. Is there anything wrong with this request? IE handles it well, but chrome freezes completely for seconds. The timeout event is fired after chrome stops freezing.
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);
});
Upvotes: 2
Views: 2115
Reputation: 5261
I don't think its the ajax call. I've seen similar situations, with the browser choking, when creating the ajax data parameter is expensive. Depending on how you're doing looping/dom traversal, performance can vary a good amount cross browser. To verify, try submitting the ajax request without doing the work to create the data parameter.
Upvotes: 2