I am working with ASP.Net MVC Razor.I have tried the following way to add a table row in my table body that is not working:
<script>
$(document).ready(function() {
@foreach (var billdetail in Model.BillDetails)
{
var row = "<tr class='productTableRow'><td>" + billdetail.ModelName + "</td><td class='price' >" + billdetail.Price + " </td><td><input type='text' class='form-control unit' data-validation='Unit' nonZero='true' currentStockAmount=" + billdetail.CurrentAmount + " /></td><td class='total'>"+(billdetail.Price*billdetail.Price)+"</td><td><input type='button' class='btn btn-danger removeRow' data-modelId=" + billdetail.ModelId + " value='Remove' / ></td><td style='visibility:hidden;'>" +
"<input type='hidden' class='hiddenModel' value='" + billdetail.ModelId + "'>" +
"<input type='hidden' class='hiddenPrice' value='" + billdetail.Price + "'>" +
"</td></tr>";
@:$("#productBody").append(@row);
}
});
</script>
It is showing the error:Uncaught SyntaxError: Unexpected token &
What is the proper way to do it.