我正在尝试在点击时加载所有嵌套的js文件,然后显示一个事件。 为此,我这样做。但每个随机脚本都失败了。
奇怪的是,它在小提琴中工作得很好,有些时候它会失败......
有了这个我想加载一个带有滑块范围的模型盒。范围滑块需要这些JS
的jQuery
$("#sliderAjaxButton").on('click', function () {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
$.getScript("URL TO SCRIPT").done(function (script, textStatus) {
alert("Script loaded");
//$("#sliderAjax").modal('show');
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript9")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript8")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript7")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript6")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript5")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript4")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript3")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript2")
});
}).fail(function (jqxhr, settings, exception) {
alert("Error During getScript1")
});
});
HTML
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="" id='sliderAjaxButton'>Show Slider Ajax</button>
答案 0 :(得分:0)
如果您想在jsfiddle中加载JS文件,只需在左侧面板中添加外部资源。