Is it possible to create HTML frames?

2

I'm in a project where the front-end layer is totally, TOTALLY separate from the banck-end. They communicate via ajax via REST.

And in this project, I'd like to break the html so I do not get duplicate content. Just as we do in ASP.NET (master.pages and usercontrols), java, php, etc. For example creating a top / header and a footer q are always fixed in a template page, and the content of that page loads only the content of other pages.

The big problem is that I need to do this using only HTML5 or at most JavaScript. As far as my knowledge goes, this is not very possible. I tried to use the iframe of the html, but it is not very functional.

Does anyone have any ideas, or reference how to solve this?

Thank you in advance.

    
asked by anonymous 01.07.2014 / 20:23

1 answer

2

In the rough would be more or less so, you would adapt according to your project

HTML

<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

    <section id="content">
        <!-- conteúdo das páginas -->
    </section>

</body>
</html>

Javascript

function pagLoad(pag) 
{
    $.ajax({
        url: pag,
        success: function(data){
            $("#content").html(data);
        }
    });
}

Example call:

pagLoad("contato.html");
    
01.07.2014 / 20:47