I have a problem with jquery's load() function.
When I click the button the first time, the page loads,
When I click it a second time, I load the page twice (seen in the debugger, network section).
When I click it for the third time, the page loads three times
So on, making the page take too long to load.
The scripts that I have on the page that loads (ver-ente.php) are also executed since they are in a $(document).ready().
the load(), is executed from the .content-inner
$(document).on("click", ".ver-detalles", function() {
id_ente = $(this).attr("id-ente");
CargarContenido('vistas/ver-ente.php', 'content-inner');
});}
here is the function
function CargarContenido(pagina_php, contenedor) {
$("." + contenedor).load(pagina_php);
}
Why it happens? How to avoid it?
Thanks for your time.