Issues (54)

public/menus.js (2 issues)

1
let except = $('#js-response').data('except'),
2
    ancestors = JSON.parse("[" + $('#js-response').data('ancestors') + "]");
3
4
function menus(element) {
5
    let parent_id = element.val() || 0,
6
        parentCount = $('select.parent').length,
7
        target = element.data('target'),
8
        url = baseUrl() + 'filter-menus?p_id=' + parent_id + '&e_id=' + except + '&pCount=' + parentCount;
9
    $.get(url, function(data, status){
0 ignored issues
show
The parameter status is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
10
        $(document).find('#child-of-parent-' + target).html(data);
11
        if(ancestors.length > 0)
12
        {
13
            $(document).find('select.parent:last').val(ancestors.shift()).change();
14
        }
15
    });
16
}
17
18
$(function () {
19
    $(document).on('change', '.parent', function (e) {
0 ignored issues
show
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
20
        menus($(this));
21
    });
22
23
    if(ancestors.length > 0)
24
    {
25
        $(document).find('select.parent:last').val(ancestors.shift()).change();
26
    }
27
});