$.ajax({
type: "POST",
url: "@Url.Action("SignInUp")",
data: JSON.stringify({ email_add: email_add ,}),
contentType: "application/json; charset=utf-8",
success: function (response) {
if (response.result == 'SignUp') {
alert("Opp`s its look like you dont have an access for this website");
window.location = response.Urls;
}
else
{
alert("Success fully login");
window.location = response.Url;
}
}
});
嗨,大家好我真的在mvc5 C#新我在柜台这个问题我想隐藏我的网址参数。任何可以帮助我谢谢你提前
这是我的代码:
public ActionResult SingInUp(string email_add)
{
bool obj = db.tblUsers.Any(x => x.email_add.Equals(email_add));
if (obj)
{
tblUser user = db.tblUsers.Single(x => x.email_add == email_add);
Session["email_add"] = user.email_add;
Session["fname"] = user.fname;
Session["lname"] = user.lname;
return Json(new { result = "Redirect", Url = Url.Action("Check", "ProjectV3") });
}
else
{
return Json(new { result = "SingUp", Urls = Url.Action("SignUp", "ProjectV3", new { email_add = email_add}) });
}
}
你不能。如果它不在url中,你认为这个值会被发送到服务器。 –
但是,您返回'JsonResult'的事实表明这是一个ajax调用,为什么不把它作为一个POST并将其发送到身体? –
你能提供一个例子,以便我能理解你的观点 – Newbie