Answer the question
In order to leave comments, you need to log in
How to show a stub while the content is loading?
Good afternoon everyone!
The customer asked to attach a third-party script to his site, the essence:
The script loads an iframe in which its document with divs and other html attributes is located, this must be loaded via ajax. this script should be loaded at the click of a button, the trick is that when you click on the button, a couple of seconds first pass before the “construction” of the entire document begins, and the customer, of course, did not like it.
Booking script:
<script type="text/javascript" src="//ext.ihbooking.ru/loader.php?key=a6bb630f550135cf655e7201d7ce87f7&objid=801&customcss=gupmc&default=true&nodescription=true"></script>
$.ajax({
type: "POST",
url: 'server.php',
dataType: "html",
data: '',
complete: function() {
console.log('Контент подгрузился (complete)');
},
success: function(result) {
console.log('Контент подгрузился (success)');
$("#content").html(result);
},
error: function(err) {
console.log(err);
}
}).always(function() {
console.log('Контент подгрузился (always)');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question