1
我有一個RedirectToAction
方法的問題。RedirectToAction不能在IE中使用jQuery
我把從我的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());
}
});
});
`
因爲你的問題是IE瀏覽器的具體我會想象的問題是客戶端 - 這樣的錯誤在JavaScript/jQuery的。你可以請你發佈你的代碼。 – 2012-02-24 11:06:48
這個代碼是EditTalent.ascx .. 當您驗證,ModifyTalent動作被調用,它的品牌數據庫和呼叫MyBooks行動復出人才的名單變化.. 謝謝你.. – user1213375 2012-02-24 11:17:27
你不能「重定向「AJAX請求。你確定它可以在Chrome和FF中使用嗎? – gdoron 2012-02-24 11:20:53