JSFiddle - React, Tailwind, and code Playground
by jfriend00
JavaScript
var urls = [
"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js",
"https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.js",
"https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe-ui-default.js"
];
var xxx = $.Deferred();
xxx.then(function() {
let options = {
dataType: "script",
url: urls[0],
cache: false
};
return $.ajax(options);
}).then(function() {
let options = {
dataType: "script",
url: urls[1],
cache: false
};
return $.ajax(options);
}).then(function() {
let options = {
dataType: "script",
url: urls[2],
cache: false
};
return $.ajax(options).then(function() {
$("body").append("Last script loaded<br>");
});
}).then(function() {
$("body").append("This is correct. All files are loaded.<br>");
});
// start the chain
xxx.resolve();