I have several pages, I wonder if you can use the same JS for the same page.
For example:
I have a HOME page, where I load the "child" pages within a% content, but for each page, I need to create a new JS
$("#lista_cli").click(function(){
$('#content').css('display', 'none');
$("#content").load('lista_clientes.php');
$("#content").fadeIn(2000);
});
$("#cadastro_cli").click(function(){
$('#content').css('display', 'none');
$("#content").load('cadastra_cliente.php');
$("#content").fadeIn(2000);
});
I've been doing some testing, at some point, when I give div
to the JS file of the home page in a content of the other page (after it loads), it shows me a ALERT
correctly, but AJAX requests do not work. Maybe it was kind of confusing, but basically:
Can you use the same JS on multiple pages? is it recommended?