У меня есть следующий Ajax Call:
$.ajax({
url: '@Url.Action("DeleteUser", "Tribes")',
dataType: "json",
type: "Post",
data: {
"tribeId": tribeId,
"buId": buId,
"userId": userId
},
success: function(data) {
if (data.status === "success") {
$.smallBox({
title: "<strong>User Deleted</strong>",
content: "<i class='fa fa-clock-o'></i> <i>Tribe user was successfully deleted! <strong></strong></i>",
color: "#659265",
iconSmall: "fa fa-check fa-2x fadeInRight animated",
timeout: 4000
},
function(data) {
window.location.href = '@Url.Action("ViewTribeUsers", "Tribes", new
{
tribeId = data.tribeId,
buId = data.buId
})';
});
}
}
});
Мой контроллер выглядит следующим образом:
public ActionResult DeleteUser(int tribeId, int buId, string userId)
{
clsTribes.DeleteTribeUsers(tribeId, userId);
return Json(new
{
status = "success",
tribeId = tribeId,
buId = buId
}, JsonRequestBehavior.AllowGet);
}
Как мне использовать data.[variables]
после вызова AJAX?В этом случае я получаю сообщение об ошибке. [Переменная] в этой строке:
window.location.href = '@Url.Action("ViewTribeUsers", "Tribes", new
{
tribeId = data.tribeId,
buId = data.buId
})';
Ошибка: имя «данные» не существует в текущем контексте
Я уверен, что это должно быть просто, любая помощь будет высоко ценится!
Спасибо!