function get_position(callback) {
tempCont.query('SELECT * from `governorates`',function (error, results) {
if (error) callback(null);
console.log("from query = " + results);
callback(results);
});
}
get_position(function (ido) {
if (!!error) {
console.log('Error in getting positions to combo box');}
else {
res.render('./register', { errors: null, positions: ido });
}
})}
<input type=text list=browsers >
<datalist id=browsers >
<% positions.forEach(function(item){ %>
<option> <%= item %>
<%});%>
</datalist>
<br>
[对象对象]不是省的名称
答案 0 :(得分:0)
<input type=text list=browsers >
<datalist id=browsers >
<% positions.forEach(function(item){ %>
<option> <%= item.role_name %>
<%});%>
</datalist>
<br>