1
我需要在成功完成ajax后添加行到html表格。这发生在一个Modal Popup窗口中,JavaScript将新行添加到父屏幕表中。除了我没有看到如何从模态中获取字段值并将其用作javascript .append语句中的变量之外,附加操作正在进行。下面是当前Ajax调用的成功方法,除了没有获取NoteText值之外,其正常工作。使用JavaScript在MVC4剃须刀中构建HTML表格行使用Javascript
success: function (result) {
var noteText = $("#NoteText").val();
$("#TenantNotesTable").append('<tr><td class="EditButton">@Html.ActionLink("Note Details", "AddTenantNote", New With {.id = 0}, New With {.id = "openDialog", .class = "ButtonControl"})</td><td class="NoteDate">@DateTime.Now.ToShortDateString</td><td class="noteText">NoteText SHOULD SHOW HERE</td><td class="EnterBy">@Model.NoteEnteredBy</td>');
$('#waitMessage').hide();
$("#dialog-edit").dialog().dialog('close');
},
请原谅这个问题,因为我正在根据需要学习Javascript。