Friday 9 June 2017

How to load and update EJS templates using AJAX?

I'm trying to update or load sections of a website using AJAX and EJS, the desired behaviour of the app is that if a hash is detected for example:#about, the about section is rendered and then inserted to remplace for example the 3 columns section etc.

I'm using NodeJS as backend with ExpressJS

<!DOCTYPE html>
<html lang=”en”>
<% include ../partials/head %>
<body>
<% include ../partials/nav %>
<section name=”jumbotron” >
 <div class=”jumbotron text-center”>
 <h1>CodePrep.io Presents</h1>
 <p>Using EJS templating with Node.js</p>
 </div>
 </section>
<% include ../partials/3columns %>
<% include ../partials/footer %>
<% include ../partials/scripts %>
</body>
</html>

If someone knows how to make something similar of what I described or another method , that would be cool , thanks beforehand ! :)



via Angelo Giuseppe

No comments:

Post a Comment