Scenario:
You send an Ajax get request to your server and you expect to print something in html.
Where do you add your HTML code to your result?
Serverside, where you print your result with all of your HTML code on your server (Here PHP)?
And simply add the Ajax result to the body afterwards:
Or Clientside, where you add the HTML part to your Ajax result, that does contain the plain result in JS?
So, which way do you prefer or is the better one?
I could see a reason for sending over the markup, but in general, I'd send over the data and let the view handle the logic. These days, if you are using a client-side framework, it has a lot of opinions on the matter, and you are generally trying to simply pass data.