categories: list children in the current category on the form that AJAX uses

Ok, I will try to describe my problem as best I can.

I have a website with ad ads.
On the listings page there is a filter form that has a list of categories on the left that AJAX uses to print results without reloading the page. Now, in the "results" section on the right, I have added a code that looks like this (see below) to print the children of the current category (subcategories)

                    $ term-> term_id,
& # 39; taxonomy & # 39; => $ term-> taxonomy,
& # 39; hide_empty & # 39; => false
));

yes (! empty ($ children)) {
?>
                    
<a href = ""> first name; ?>

now … everything works fine when I click on the category link or paste the url of the direct category in the browser's address (when the page is reloaded), but unfortunately none of the secondary categories is printed when sent the filter on the left using ajax (when the page does not) t reload). What I want to achieve is to get a list of children in the current category also when I click on the Submit button in the filter section (ajax).

Here's how you see the shipping code of form js

                / * send form and fill in new results * /
submitForm function (page) {
var $ form = $ (& # 39 ;. search-form & # 39;);
var data = $ form.serialize ();
var $ holder = $ (& # 39 ;. ajax-search & # 39;);
var $ orderby = $ (& # 39 ;. orderby & # 39;);
var $ pagination = $ (& # 39 ;. pagination span & # 39;);
var $ layout = $ (& # 39 ;. layout-view a.active & # 39;);
$ holder.addClass (& # 39; loading & # 39;);
if ($ orderby.length> 0) {
data + = & # 39; & af_orderby = & # 39; + $ orderby.val ();
}
if ($ pagination.length> 0) {
page = page? page: $ pagination.text ();
data + = & # 39; & af_page = & # 39; + page.toString (). replace (/, / g, "");
}
if ($ layout.length> 0) {
data + = & # 39; & layout = & # 39; + $ layout.data (& # 39; style & # 39;);
}
$ .ajax ({
url: $ form.attr (& # 39; action & # 39;),
method: & # 39; POST & # 39 ;,
data: data,
success: function (answer) {
$ (& # 39 ;. ajax-search & # 39;). html ($ (response) .find (& # 39 ;. ajax-search & # 39;). html ());
$ (document) .trigger (& # 39; adifier-new-search & # 39;);
}
complete: function () {
$ holder.removeClass (& # 39; loading & # 39;);
var scroll_to = $ holder.offset (). top;
var $ admin = $ (& # 39; # wpadminbar & # 39;);
var $ sticky = $ (& # 39 ;. sticky-nav & # 39;);
if ($ sticky.length> 0) {
scroll_to - = $ sticky.height ();
}
if ($ admin.length> 0 && $ admin.css (& # 39;) & # 39;) == & # 39; arranged & # 39;) {
scroll_to - = $ admin.height ();
}

if (! searchWithMap) {
$ (& # 39; html, body & # 39;). animate ({
scrollTop: scroll_to - 60
}, 500);
}
plus{
if ($ (window) .width () <= 736) {
$ (& # 39; html, body & # 39;). animate ({
scrollTop: scroll_to
}, 500);
}
plus{
$ (& # 39 ;. search-map-results-results-content & # 39;). animate ({
scrollTop: 0
}, 500);
}
}
}
});
}