Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

1
  • It depends on the location and purpose of the 2nd controller. If it returns e.g. a JsonResponse with the calculated amounts then it's fine. The calculations should live in a Service class that this and any other part of your system can call on, whether it's another Service, Controller, etc. So the AJAX call can call the API controller, pass in values, API controller calls ServiceCalculator and gets the calculated values, then passes back to API controller which turns it into a JsonResponse and back to AJAX Commented Aug 20, 2023 at 20:50