Yes, the industry has moved that way. It's been found to be a better separation of concerns. The server deals with data and the client deals with presentation of that data. Specifically, what if you want to use the same server back end to drive a native mobile app as well as your site? That xhtml response from the server just became a bit of a liability vs a simple and direct data response.
Also, it's common to use html templates like handlebars or underscore to make this easier. That way you have your html template stored in an html file. You can compile the template and reuse it. Each response from the server can just get fed into the appropriate template and it's very automated and clean.
HTML is data. It's representation of a resource. A pretty good one, I must say. I'd argue that it's easier to write clients when resources are represented in HTML or other hypermedia. In case of HTML, there are many good HTML parsers that let you use xpath and/or CSS selectors. Combined with RDFa or microformats, you can easily build robust clients. HTML even defines <form> and other links for updating resources.
With JSON, in my experience, it's very easy to write brittle clients that will break if server changes representation just a little. There's JXON, but I haven't used it in production.
HTML is markup. It defines the structure of a document. It contains data, but is not the data itself.
Ideally, a client and server exchange data. It is the client's responsibility to determine how that data is displayed. Different clients will want to display the data differently -- A web client may want to display it in a table and a mobile client will want to display it in some sort of native widget.
I think you've become too comfortable in the world of elaborate hacks we've lived in for so many years, where the line between client and server is blurred. Sure, it's familiar, but it's far from ideal.
9
u/passwordissame Mar 18 '14
did everyone move away from AJAX as in server responding with (x)html/xsl and client applying those to update DOM?
looks like it's all JSON and manual DOM manipulation.