If you think that the most important letter in MVC is V for working with AJAX. AJAX with HTML and JS is part of the presentation layer, so in theory this is the place for View - part.
View is responsible for what you send to the end user, and MVC-patter is not only the separation of the model, view and controller, but also the ability to use multiple views for the same data model.
Therefore, it is best to encapsulate the code in the class and use the same controller code to render different views. In the first case, it can be a drawing of a static page, but in the other case it is a look specially designed for AJAX calls, and the data can be in JSON or another standard format, it does not matter if you respect the responsibilities that each level has.
source share