Please note; this is NOT a duplicate of one of the other similar questions here on SO, as I clearly explain in the fifth paragraph of this question. Furthermore, it is not opinion based. I'm merely asking for the pro's and cons of the two ways of doing things, and specifically why Stackoverflow does things the way it does them.
For my website I'm building a notification similar to how it is implemented here on Stackoverflow at the top; when you click the notifications icon, a dropdown is presented with the relevant notifications.
I currently wrote my system in a way that the api call returns a list of json objects containing the notifications, and I then construct the html in javascript in the browser. But when I look at the network calls made by SO, I see that the api call here simply returns the html which is then pasted into the dropdown.
I now wonder; why does SO do it like this? In my opinion it is way more efficient to just provide the data in json instead of all the html surrounding it.
I checked out another question on this topic here: which suggests a third option; some kind of templating system, but that is a bit too much for the simple html that I want to insert. So I don't really want to consider that option. One more question on this topic talks specifically about the performance difference, which I'm not too concerned about either (maintainability and simplicity is more important for me than those couple milliseconds difference).
So my question is; is it more advantageous (for whichever reason) to supply all the html or just the json on an api call, and why?