there is a action: /Home/GetName, and return a string "Mike", the controller and action like:
public class HomeController : Controller
{
public string GetName()
{
return "Mike";
}
}
how can I display this action result in view? (without ajax is better)
You can use the ContentResult
to return string like
public ActionResult GetName() {
return Content("Mike");
}
Note that by default a type of text/plain is returned by ContentResult
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With