我正在尝试从 Ajax 函数打开 URL,但未调用该 URL。
我使用回调是因为我希望我的数据在另一个域中完成(使用我的 javascript)。
这反过来我用 Asp.Net Core 中的 iactionresult 方法对其进行了修复
我想要的是,当肯定的答案到达时,我打开我在 ajax 方法中指向的 url
我正在使用 iss express 和 vs 2019
function ValidarExisteContactoPago() {
var Nombre;
var IdUsuario;
if ($("#Nombre").val() !== null || $("#IdUsuario").val() !== null) {
IdUsuario = $("#IdUsuario").val();
Nombre = $("#Nombre").val();
$.ajax({
type: "GET",
url: "/Pago/IndexTCS",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: {
IdUsuario: $("#IdUsuario").val(),
Nombre: $("#Nombre").val()
},
async: false,
success: function (data, status) {
alert("Data: " + data + "\nStatus: " + status);
if (status === "success") {
window.location.href = "/Pago/IndexTC";
} else {
console.log('Data received: ');
}
},
error: function (data, status) {
console.log('Data received: ');
}
});
} else {
console.log('Data received: ');
}
}
public IActionResult IndexTC()
{
return View();
}
[HttpGet]
public JsonResult IndexTCS(UsuarioViewModel usuarioView)
{
//RedirectToAction("IndexTC", "Pago");
bool successToStoreData = SomeMethod(usuarioView);
if (successToStoreData)
{
return Json(usuarioView); // indicates success
}
else
{
return Json("Your error message");
}
}
海绵宝宝撒
达令说
相关分类