Why I am getting this error in js file Uncaught TypeError: $(...).on(...).fail is not a function?
08:35 21 Nov 2025
(function ($) {
    app.modals.ClassificationTreeModal = function () {
        var selectedId = [];
        var _stocktakingSessionsService = abp.services.app.stocktakingSessions;
        var _modalManager;
        this.init = function (modalManager) {
            _modalManager = modalManager;
            var modal = _modalManager.getModal();
        };
        alert('A');
        $(".modal-dialog modal-xl").removeClass("modal-dialog modal-xl").addClass("modal-dialog modal-xl modal-dialog-scrollable");
        $(".content d-flex flex-column flex-column-fluid").removeClass("content d-flex flex-column flex-column-fluid").addClass("modal-body");

        _stocktakingSessionsService.getClassificationTree(
            1,
            2
        ).done(function (data) {

            var res1 = JSON.parse(data);
            $('#jstree').jstree({
                core: {
                    data: res1,
                    check_callback: true,
                    "themes": {
                        "variant": "large"
                    }
                },
                "types": {
                    "default": {
                        "icon": "fa fa-folder text-primary"
                    },
                    "file": {
                        "icon": "fa fa-folder text-primary"
                    }
                },
                'checkbox': {
                    //keep_selected_style: false,
                    ////whole_node: false,
                    ////tie_selection: true
                    //three_state: false,
                    //cascade: 'none'

                },
                'search': {
                    'case_insensitive': true,
                    'show_only_matches': true
                },
                "plugins": ["search", "wholerow", "checkbox"]

            }).on('search.jstree', function (nodes, str, res) {
                if (str.nodes.length === 0) {
                    $('#jstree').jstree(true).hide_all();
                }
            });

            $('#deliverable_search').keyup(function () {

                $('#jstree').jstree(true).show_all();
                $('#jstree').jstree('search', $(this).val());
            });

            $('#jstree').on('changed.jstree', function (e, data) {

               

                selectedId = []
                for (var i = 0; i < data.selected.length; i++) {
                    selectedId.push(data.instance.get_node(data.selected[i]).id);
                }

            });

            var inputString = document.getElementById('arrayInput').value;
            var nodesToCheck = JSON.parse(inputString);
            $('#jstree').on('loaded.jstree', function () {
                // Check the node with id '2'

                nodesToCheck.forEach(function (nodeId) {

                    $('#jstree').jstree('check_node', nodeId.toString());
                });


            }).fail(function (err) {

            });






        });

            this.save = function () {
                var arr = selectedId

                var data = {
                    arr2: selectedId,

                };
              
                _modalManager.setResult(data);
                abp.event.trigger('app.ClassificationTreeStocktakingSessionModalSaved', data);
                abp.notify.info(app.localize('SavedSuccessfully'));
                _modalManager.close();

            };
 }


})(jQuery);

 
javascript