3
How could I make for that function .load instead of loading the contents of <body> only load content inside <main> ?
My jQuery:
// Checa se a página foi carregada para evitar aplicar os códigos antes de ter algum elemento não carregado. Pode-se usar também "$(function(){".
        $(document).ready(function(){
            $(".ajax").on("click", function(e){
                e.preventDefault(); //eliminamos o evento
                var path = $(this).attr("href"); //Pegamos o caminho
                var titulo = $(this).data('titulo'); //pegamos o titulo da página
                document.title = titulo; // Alterar o titulo da página
                window.history.pushState("", titulo, path);   
                $("main").empty(); //Limpa para poder colocar o conteúdo.
                $("main").load(path); //Faz uma requisição http para o servidor.
            });
        });
HTML:
<body>
    <!-- No caso, o header é a parte fixa, que não muda. -->
    <header>
        <div>"Aqui fica o player de audio."</div>
        <ul>
            <li><a href="home.html" class="ajax" data-titulo="Início do meu Site">Home</a></li>
            <li><a href="sobre.html" class="ajax" data-titulo="Sobre mim">Sobre</a></li>
        </ul>
    </header>
    <main>
        <!-- Aqui é onde o conteúdo vai ser carregado. -->
    </main>
</body>
Hello @Jader I was gone all day yesterday. I will test your example. I believe it will work because I think the problem is in this (path) same. D
– Alexandre Lopes
It worked! Vlw Jader, again solving my problems, rsrs...
– Alexandre Lopes
See: http://player.esy.es/new/
– Alexandre Lopes