Hacker News new | past | comments | ask | show | jobs | submit login

There's clearly advantages to writing a web app as an SPA, otherwise web devs wouldn't do it. The idea that web devs "don't care" (about what exactly?) really doesn't make any sense.

Moving interactions to JSON in many cases is just a better experience. If you click a Like button on Facebook, which is the better outcome: To see a little animation where the button updates, or for the page to reload with a flash of white, throw away the comment you were part-way through writing, and then scroll you back to the top of the page?

There's a reason XMLHttpRequest took the world by storm. More than that, jQuery is still used on more than 80% of websites due in large part to its legacy of making this process easier and cross-browser.




> To see a little animation where the button updates, or for the page to reload with a flash of white, throw away the comment you were part-way through writing, and then scroll you back to the top of the page

I don't understand how web devs understand the concept of loading and manipulating JSON to dynamically modify the page's HTML, but they don't understand the concept of loading and manipulating HTML to dynamically modify the page's HTML.

It's the same thing, except now you don't have to do a conversion from JSON->HTML.

There's no rule anywhere saying receiving HTML on the client should do a full page reload and throw up the current running javascript.

> XMLHttpRequest

This could've easily been HTMLHttpRequest and it would've been the same API, but probably better. Unfortunately, during that time period Microsoft was obsessed with XML. Like... obsessed obsessed.


I don't think Facebook is the best example given the sheer number of loading skeletons I see on their page.


Rendering JSON into HTML has nothing to do with XMLHttpRequest.

Funny that you mention jQuery. When jQuery was hugely popular, people used it to make XMLHttpRequests that returned HTML which you then set as the innerHTML of some element. Of course being jQuery, people used the shorthand of `$("selector").html(...)` instead.

In the heyday of jQuery the JSON.parse API didn't exist.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: