I’m new to CodeIgniter and MVC. I’m having some trouble trying to figure out the best place to put a snippet of HTML. I know that the answer is probably in the View area. Here is the problem, sometimes I want the snippet of HTML to be called normally, but other times I need AJAX to call it and to return it as JSON. How do I accomplish this?
On my webpage I have a “Add” button. This calls the Ajax and should return with some JSON that contains the HTML and the ID of the HTML.
This seems like this should be a common thing that people want to do. How do I accomplish this?