What I want to achieve is by js
- jquery
and / or ajax
generate a switch
similar to PHP
using buttons in <nav
.
That is:
$(document).ready(function(){
$(".click").click(function(){
$("#box").load("/file.php");
});
});
<div id="box">
</div>
<a href="#" class="click">Cargar</a>
This would load file.php into element with id #box
when clicking on item with class .click
What I want to achieve:
<a href="#" onclick="loadFiles()" id="1"></a>
<a href="#" onclick="loadFiles()" id="2"></a>
<a href="#" onclick="loadFiles()" id="3"></a>
<div id="contenido-dinamico"></div>
When onclick="loadFiles"
runs, load X file according to id="file(numero)"
But with condition that when loading 1, 2 and 3 are not displayed.
Is this possible?