我有以下 javascript:
var newAmount = parseInt(amount)
var price = data[0]['Product']['pris'];
var id = data[0]['Product']['id'];
var dat = data;
if($("#shopping_table")){
$('#shopping_table_body').append(
"<tr id=''+id >" +
"<td class='image'>" +
""+
"</td>" +
"<td class='name'>" +
" "+data[0]['Product']['name'] +
"</td>"+
"<td class='quantity'>" +
""+amount +""+
"</td>"+
"<td class='total'>" +
""+price*amount+
"</td>" +
""+
"<td class='remove'>" +
"<input type='button'class='icon-remove' onclick='removeItemFromBasket(id)'>"+
"</td>"+
"</tr>"
);
请注意,这是从正常工作的 Ajax 调用的上下文中取出的。
现在,当我检查 html 时,我得到以下输出:
<tr id="" +id="">
<td class="image"></td>
<td class="name"> Telt</td>
<td class="quantity">1</td>
<td class="total">123.95</td>
<td class="remove">
<input class="icon-remove" type="button" onclick="removeItemFromBasket(id)">
</td>
谁能告诉我我做错了什么?