我的RedirectToAction
方法存在问题。
我从jQuery代码和DeleteTalent
调用中调用DeleteTalent
操作
删除人才以显示刷新内容后的RedirectToAction("MyBooks")
操作。
这在Chrome和Firefox中运行良好,但在Internet Explorer中未调用MyBooks
操作。任何人都可以告诉我原因。
谢谢。
`<script type="text/javascript">
var controller = "/MyBooks";
var action = 'ModifyTalent';
var temp = [];
$('input[name=Validate]').click(function ()
{
$('textarea[name=presentation]').each(function ()
{
var toPush;
if ($(this).attr('id') == null)
{
toPush = { MyPresentationId: -1, Presentation: $(this).val() };
}
else
{
toPush = { MyPresentationId: $(this).attr('id').split('_')[1], Presentation: $(this).val() };
}
temp.push(toPush);
});
var presentations = JSON.stringify(temp);
var talentId = $('[name=talent]').attr('id').split('_')[1];
var talent = $('[name=talent]').val();
var datas;
if ($(this).attr('id') == -1)
{
action = 'CreateTalent';
datas = 'id=' + $('#IdBook').val() + '&talent=' + talent + '&presentations=' + presentations;
}
else
{
datas = 'id=' + talentId + '&talent=' + talent + '&presentations=' + presentations;
}
$.ajax({
url: controller + '/' + action,
type: 'POST',
dataType: 'html',
data: datas,
success: function (data) {
$("#bodyPage").html(data.toString());
}
});
});
`
答案 0 :(得分:1)
看起来您正在使用AJAX POST来调用控制器/操作。
使用AJAX帖子时,RedirectToAction不起作用。我试图在使用AJAX帖子的JQuery Mobile中做同样的事情时发现了这一点。