2
I am making a simple portfolio that will not need any framework as angular or React, what I would like and do something so that I could create separate html files and a main just by swapping the content of the page with Javascript. Something like that, my index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>titulo principal que vai estar em todas as paginas</h1>
<div>
div onde quero ficar alterando meus arquivos
</div>
</body>
</html>
Any other file:
<div>subtitulo da pagina</div>
Another html file
<div>outro subtitulo</div>
I want to get these files into my main html, I don’t care to import all the css and javascript directly into my main file since it will be something very light, but I would love to make this file exchange system.
You want to make a
one page application
this is usually done with Ajax. It would be better if you study Ajax than to ask for opinion, Voce can take a look: W3schools or MDN MDN is more recommended because it is more updated, whereas W3schools is more practical, goes straight to the point, but a little outdated.– Alex
I had no idea where to start, I will study Ajax and see if I can do it. Thank you.
– Erick Zanetti
I think this might help you: https://answall.com/a/276631/99718
– Valdeir Psr