public IActionResult MessageHandler()
{
var result = new[] { @"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++",
"Clojure", "COBOL", "ColdFusion", "Erlang","Fortran", "Groovy","Haskell",
"Java", "JavaScript", "Lisp", "Perl", "PHP", "Python","Ruby", "Scala", "Scheme" };
return Json(result);
}
public Object MessageHandler()
{
StreamReader sr = new StreamReader(Request.Body);
string data = sr.ReadToEnd();
string result = "Сообщение " + data;
return result;
}
$.ajax({
type: 'POST',
url: 'Home/MessageHandler',
data: "Test msg данные тут",
success: function (data) {
console.log(data)
},
error: function () {
alert("Произошел сбой");
}
});