您好我有我的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/ –