1

The page is loaded as a normal MVC page. The ajax is so the user can add items to their model without having to reload the page.

Right now there is no Web API in the project. I don't want to add it unless it makes sense but I'm worried that using AJAX on an MVC controller is bad.

All the books I've read and at work we only do AJAX to Web API. Is that a convention or am I "allowed" to POST an AJAX to an MVC Controller?

  • 2
    ASP.NET MVC has great support for Ajax. Web API has a lot of tooling to make a RESTful API, however if you're just looking to add some ajax calls ad-hoc, then MVC will be just fine. – Matthew Aug 24 '16 at 16:01
  • 2
    You can certainly perform an AJAX post to an MVC controler and receive JSON as the response. It is a common and perfectly valid practice. – Eric King Aug 24 '16 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.