I send ajax request using this code:
$.ajax({
url: "/Home/ShowStadium",
contentType: "application/json; charset=utf-8",
dataType: "text",
type: "POST",
data: Club,
success: function (data) {
$(".right-content").html(data);
},
error: function (xhr, textStatus) {
alert([xhr.status, textStatus]);
}
});
In HomeController i have this function:
[HttpPost]
public ActionResult ShowStadium(){
if (Request.Form["Club"] == "Some text to compare")
{
return Content("First variant");
}
else
{
return Content("Second variant");
}
}
But i can't get data sent by ajax to compare it. Request.Form["Club"] - not working!
Clubindata: Club,? Your should add a parameter to you methodpublic ActionResult ShowStadium(string Club) {...