0

i am trying to load all nested js files on click and then show an event. For this i am doing this. but getting failed every random script.

Strange it is working fine in Fiddle and some time it is getting failed..

With this i want to load a model box with range Slider. and the range slider needed these 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>
Naresh
  • 2,761
  • 10
  • 45
  • 78

1 Answers1

0

IF you want to load JS files in jsfiddle, simply add external resources, in the left panel.

ghusse
  • 3,200
  • 2
  • 22
  • 30