Hey Guys,I have a x.js file, that has the following code:app.get('/place/data', function (req, res) { connection.query('SELECT placeid FROM place_list ', function (err, rows, fields) { if (err) { console.log(err); } plArray = []; rows.forEach(function (row) { plArray.push({pid: row.placeid}); }); res.render('place/placenode.ejs', {data: plArray, myMap: linksManager}); } ); }); I have the placenode.ejs file like this: <% for(var i = 0; i < data.length; i++) { %> --- ******
Place ID: <%= data[i].pid %>
<% } %>****** -- THE ERROR AT THIS LINE WAS: data is not defined. What am I doing wrong?
Submitted April 03, 2017 at 04:50AM by theflyingmonkey3
No comments:
Post a Comment