I have a node.js and handlebars CRUD app.
I want to display data from mySQL database to a bootstrap modal but i can't render the modal, (it wont show). How do i show the data into the modal? My existing code in app.js:
//edit address details
app.get('/edit-address/:id', function (request, response) {
var id = request.params.id
let sql = "SELECT * FROM addresses"
var edit;
console.log(id)
connection.query(sql, function (err, results) {
if (err) throw err;
for (let index = 0; index < results.length; index++) {
console.log(results[index].id)
if (id == results[index].id) {
edit = results[index]
break;
}
}
console.log(edit)
response.render('partials/user/editaddress_modal', { edit: edit });
// data-toggle="modal" data-target="#editaddress-modal"
});
})