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?
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?
You can also just return string if you know that's the only thing the method will ever return. For example:
there is 2 way to return a string from controller to the view
first
second
here is the code samples to do this
in view file to run AutoProperty it will redirect you to Result view and will send s
code to view
You can just use the
ContentResult
to return a plain string:ContentResult
by default returns atext/plain
as its contentType. This is overloadable so you can also do: