On my explicit server, I display the data page as follows:
app.get('/people/:personID', function (req, res) {
res.render("people/profile", {person: req.person });
});
In my profile.ejs file, I can access the data in the ejs tag, for example: <p><%= person.name %></p>
I cannot figure out how to change the attribute of the html tag to the value stored in this object.
This does not work: <img id="my_img" src=<%= person.picture %> alt="">
or this:$("#my_img").attr("src", <%= person.picture %>);
Also, if there is a better way to transfer this document to the html page and access it, Iβm all ears (or eyes in this case). Thanks you
source
share