您好我有我的asp.net mvc應用程序中的jquery window.location.href
問題我在做什麼是我有一個網格視圖的幫助下Html.actionlink
我呼籲其刪除記錄後,我必須重定向或在阿賈克斯成功重新加載相同的觀點我的網頁刪除從數據庫中, 行Ajax請求:window.location.href在Asp.Net MVC應用程序谷歌瀏覽器不工作
我的WebGrid
@grid.GetHtml(
columns: grid.Columns(
grid.Column("ID", "ID",canSort:false),
grid.Column("Area", "Area",canSort:false),
grid.Column("", header: "Actions", style: "grid-actions", format: @<text>
@Html.ActionLink("Delete", null, "", new { }, new { data_id = item.ID, @class = "Delete-Row" })
</text>)
))
而且我JQuery的阿賈克斯
$(".Delete-Row").on('click', function() {
var Id = $(this).data("id");
var isTrue = confirm("Are you want To delete")
if (isTrue) {
$.ajax({
url: '@Url.Action("DeletaArea", "SetupHr")',
data: { id: Id },
type: "GET",
success: function (data) {
window.location.href = '@Url.Action("IndexArea", "SetupHr")';
},
error: function (data) {
window.location.href = '@Url.Action("IndexArea", "SetupHr")'; }
});
}
else {
return false;
}
});
嗯......你確定你的Ajax調用的工作:能夠與
這樣做呢? – LMK
Ajax工作正常, –
基本上我不會採取我的目標位置,通過'Html.actionlink'它創建一個默認的一些東西像href =「hrms /」帳戶/ IndexArea/ –