node.js - Rendering data in handlebars using express framework -
hello working in express framework, using handlebars render data mysql table. while trying render data using below code,instead of rendering value displaying [object object]. posted code below.
index.js:
var query = connection.query('select * requestor_auth question_id = ? , answer = ? , app_key = ? limit 1', [data.qid, data.ansvalue, data.appid], function(err,rows) { if(err) { console.log("error selecting : %s ",err ); res.redirect('/'); } else { res.render('requestform',{page_title:"edit customers - node.js",data:rows}); }
requestform.hbs:
<div class="addressto"> <h4>to,</h4> <br> <span style="font-size:18px;margin-left:10px;">the collector of</span> <input type="text" value="{{data}}" class="line" class="text-line" style="margin-left:35px;"><br> </div>
the value in form input displaying [object object]. tried data.key_value render data not displaying value. please give me solution. thank you.
because result of mysql response array should be:
var query = connection.query('select * requestor_auth question_id = ? , answer = ? , app_key = ? limit 1', [data.qid, data.ansvalue, data.appid], function(err,rows) { if(err) { console.log("error selecting : %s ",err ); res.redirect('/'); } else { res.render('requestform',{page_title:"edit customers - node.js",data:rows[0]}); }
if there's same error should console.log()
result check value.
Comments
Post a Comment