问题
My Simple jQuery's load statement taking too much time (50+ seconds). There is no server side issue and server's page logic is simple. I also have tried $.ajax, $.get and even tried using Manual AJAX call (XMLHttpRequest).
Following is the example with jQuery load.
$(function() {
$('#frmPrd').live('submit', function(event) {
event.preventDefault();
mUrl = "page1.php";
$.ajax({
url: mUrl,
type: 'POST',
data: $("#frmPrd").serialize(),
success: function() {
//Logged Unix timestamp here which was 1448631101 (27 Nov 2015 13:31:41 GMT)
$("#dvCart").load("page.php");
},
error: function() {
alert('Error occurred.');
}
});
});
});
And then in page.php I logged (very first statement of page) timestamp which returned 1448631153 (27 Nov 2015 13:32:33 GMT) i.e. 52 seconds difference from the timestamp I logged before calling the page. What can be the issue here? Where are these 50+ seconds wasted? Also note that this delay is for first call, for all coming calls the delay is normal. My whole website runs on https (TLS 1.2)
回答1:
It was initial handshake with https server which was taking time.
来源:https://stackoverflow.com/questions/33958840/jquery-simple-load-taking-too-much-time-for-first-call