Só funciona em um dominio, mesmo que seja http://localhost
.
- Crie um arquivo
include.js
.
$( document ).ready(function() {
//loads static html content
$("[data-load]").each(function(){
$(this).load($(this).data("load"), function(){
});
});
});
-
Carregue o arquivo criado no rodapé do arquivo onde vai receber includes.
-
Coloque o código abaixo para fazer o include:
<nav class="nav-bar" data-load="inc/mainmenu.html"></nav>