我试图从控制器重新加载视图,以便在对控制器进行AJAX POST调用后显示存储在TempData中的数据。问题是我对方法RedirectToAction的调用未重定向任何内容。
这是一些代码示例
视图:
$('#incidentTableBody').on('click', 'button.relayBack', function () {
Post('/Incident/RelayBack', { incidentId: $(this).parent().parent().data('id'), ownerId: $(this).parent().parent().data('ownerid') }, function () { });
});
function Post(action, data, callback) {
$.ajax({
url: action,
type: "POST",
data: data,
//error: function (jqXHR, textStatus, errorThrown) {
// console.log(errorThrown);
//},
success: callback,
cache: false
});
}
Run Code Online (Sandbox Code Playgroud)
控制器:
[Authorize]
public ActionResult IncidentList()
{
ViewBag.Title = "IncidentList";
return View();
}
[HttpPost]
[Authorize]
public ActionResult RelayBack(string incidentId, string ownerId)
{
bool success;
try
{
new Guid(_incidentService.RelayBack(new Guid(incidentId), new Guid(ownerId)));
success = …Run Code Online (Sandbox Code Playgroud) I would like to had (multiple) data-attributes to the generated rows of my JQuery DataTable so that I can store data in it.
What I want to achieve is to make DataTables generate something like this:
<tr data-foo="bar">
<td></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
Is it possible? How to do it? Thanks.