0

If I call my MVC controller via Ajax, should the controller then as a rule always return a Json (JsonResult) or can it be a view (ViewResult) as well?

1
  • It doesn't need to be a Json, you can return a PartialViewResult which can be interpreted then in the browser as html Commented Oct 18, 2014 at 22:03

1 Answer 1

1

It can return either of them but a viewresult would typically be an html string while a json result would be json (native to javascript).

They are situations where you'll may need to return a view (if you need to update sections of your page)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.