Is it bad practise to call a controller action from a view that was rendered by another controller?
- by marco-fiset
Let's say I have an OrderController which handles orders. The user adds products to it through the view, and then the final price gets calculated through an AJAX call to a controller action.
The price calculation logic is implemented in a seperate class and used in a controller action. What happens is that I have many views from different controllers that need to use that particular action. I'd like to have some kind of a PriceController that I could call an action on. But then the view would have to know about that PriceController and call an action on it.
Is it bad practice for a view to call an action on a different controller from which it was rendered?