我有以下工作正常:
html: "<td>" + goalcard.Name + "</td><td>" + goalcard.Customer + "</td><td>" + goalcard.PlannedDate + "</td><td>" + goalcard.CompletedDate + "</td>"
当我尝试这个时,我会显示我的 JSON。
html: "<td>" + goalcard.Name + "</td><td>" + goalcard.Customer + "</td><td>" + goalcard.PlannedDate + "</td><td>" + goalcard.CompletedDate + "</td><td>" + @Html.ActionLink("Ändra", "Edit") | @Html.ActionLink("x", "Inactive", new { @class = "deleteLink" }) + "</td>"
我还收到一堆错误,例如:
- 函数外的'return'语句'
- 预期的 ';'
- 语法错误
- 预期的标识符或字符串
我在这里做错了吗?
这是完整的功能:
result.forEach(function (goalcard) {
$("#GoalcardSearchResult tbody").append(
$('<tr/>', {
click: function() {
id = goalcard.Id;
var url = '@Url.Action("AnswerForm", "AnswerNKI", new { id = "__id__"})';
window.location.href = url.replace('__id__', id);
},
// steg Create a row for each result
html: "<td>" + goalcard.Name + "</td><td>" + goalcard.Customer + "</td><td>" + goalcard.PlannedDate + "</td><td>" + goalcard.CompletedDate + "</td><td>" + @(Html.ActionLink("Ändra", "Edit")) | @(Html.ActionLink("x", "Inactive", new { @class = "deleteLink" })) + "</td>"
}));
});
$('#GoalcardSearchResult tbody').trigger("update");
$("#GoalcardSearchResult").tablesorter();
});
return false;
提前致谢!