Good afternoon, I have a modal in which I show a list of indicators that are related to a previously selected indicator. I created a javascript function so that when selecting an option from this list, it hides the modal and changes the div of my page with the selected content.
the function is as follows:
function ocualtar(div, page) {
$("#miModal").modal('hide'); //ocultamos el modal
$(div).load(page, function (data, status, xhr) { //aquí hago el cambio en el div
if (status == "error") {
$("#errorPrincipal").html(data + "<br/>" + xhr.status + " " + xhr.statusText);
} else {
//$(div).html(data);
finalizar();
}
}); }
my problem is that everything is done fine except that the screen goes black but you can see that if you made the change in the div it is as if the modal had not been closed.
How can I make it so that it first closes the modal properly and then makes the change in the div ?
I already found the solution to my problem just add the following to the original function