$.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