[英]Expected an assignment or function call and instead saw an expression?
I keep getting this error: 我不断收到此错误:
"Expected an assignment or function call and instead saw an expression and instead saw an expression”
“预期了一个赋值或函数调用,而是看到了一个表达式,而是看到了一个表达式”
when trying to use Javascript to append my table. 尝试使用Javascript追加表时。
Can anyone help me rectify this? 谁能帮我纠正这个问题?
$('#lbUsers tbody').append('<tr><td>' + row.Number + '</td><td> ' + row.Name + '</td><td> ' + row.points + '</td><td>`' + row.stars + ' </td><td>' + row.Type '</td></tr>');
Full code: 完整代码:
$('#lbUsers').html('');
db.transaction(function (transaction) {
transaction.executeSql('SELECT * FROM People;', [],
function (transaction, result) {
if (result !== null && result.rows !== null) {
for (var i = 0; i < result.rows.length; i++) {
var row = result.rows.item(i);
`$('#lbUsers tbody').append('<tr><td>' + row.Number + '</td><td> ' + row.Name + '</td><td> ' + row.points + '</td><td>`' + row.stars + ' </td><td>' + row.Type '</td></tr>');
}
}
}, errorHandler);
}, errorHandler, nullHandler);
return;
}
HTML: HTML:
<table id="lbUsers">
<tbody>
<th>Number</th><th>Name</th><th>Points</th><th>Stars</th><th>Type</th>
</tbody>
</table>
The problem is with the following line: 问题在于以下行:
`$('#lbUsers tbody').append('<tr><td>' + row.Number + '</td><td> ' + row.Name + '</td><td> ' + row.points + '</td><td>`' + row.stars + ' </td><td>' + row.Type '</td></tr>');
There should not be a leading ` character. 不应包含主角`。 Also, you are missing a concatenation operator ("+") after
row.Type
. 另外,您在
row.Type
之后缺少串联运算符(“ +”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.