In my ajax call, I want to return a string value back to the
calling page.
Should I use ActionResult or just return a string?
Home / DeveloperSection / Forums / In MVC, how do I return a string result?
In my ajax call, I want to return a string value back to the
calling page.
Should I use ActionResult or just return a string?
David Miller
22-Jan-2015You can just use the ContentResult to return a plain string:
ContentResult by default returns a text/plain as its contentType. This is overloadable so you can also do:
return Content("<xml>This is poorly formatted xml.</xml>", "text/xml");