jquery - How can i display the data after few seconds? -


i know shouldn't want make spinner longer user. because moment ajax request quick user not able see spinner.

is there anyway put @ least 5 secondes instance, after these 5 second data displayed.

$.ajax({   type: "post",   url: $('#ajaxmorestatus').attr("data-url"),   datatype: "html",   beforesend: function() {     $('.spinner').show();   },   complete: function() {     $('.spinner').hide();   },   success: function (data) {     $('#ajaxmorestatus').append(data);   } }); 

just use settimeout fake delays:

$.ajax({   type: "post",   url: $('#ajaxmorestatus').attr("data-url"),   datatype: "html",   beforesend: function() {     $('.spinner').show();   },   complete: function() {     settimeout(function () {       $('.spinner').hide();     }, 5000); // 5 seconds.   },   success: function (data) {     $('#ajaxmorestatus').append(data);   } }); 

if want delay loading too, use on success function too:

$.ajax({   type: "post",   url: $('#ajaxmorestatus').attr("data-url"),   datatype: "html",   beforesend: function() {     $('.spinner').show();   },   complete: function() {     settimeout(function () {       $('.spinner').hide();     }, 5000); // 5 seconds.   },   success: function (data) {     settimeout(function () {       $('#ajaxmorestatus').append(data);     }, 5000); // 5 seconds.   } }); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -