174
rated 0 times
[
177]
[
3]
/ answers: 1 / hits: 21793
/ 10 Years ago, sun, june 1, 2014, 12:00:00
On my express server I'm rendering a page with data 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 an ejs tag like so: <p><%= person.name %></p>
I can't figure how to change an attribute of an html tag to the value stored in this object though.
This doesn't work: <img id=my_img src=<%= person.picture %> alt=>
or this: $(#my_img).attr(src, <%= person.picture %>);
Also, if there's a better way to pass this document to the html page and access it I'm all ears(or eyes in this case). Thank you
More From » jquery