Here is the server-side code snipped that handles GET request:
app.get('/', function(req, res){
res.sendFile(__dirname + "/public/html/index.html");
});
app.get("/new-html", function(req, res){
console.log("Request /new-html");
res.sendFile(__dirname + "/public/html/new.html");
})
And this is the code in the client-side that triggers the request:
$("#load-html").click(function() {
$.get("/new-html")
})
The index.hml itself is rendered when the page is loaded and request with root url is made.
What I want is when I hit button with id=load-html
to receive and render completely new html file returned by the server.