I read this article here that talks about progressive enhancement for javascript and the author mentioned:
First, build an old-fashioned website
that uses hyperlinks and forms to pass
information to the server. The server
returns whole new pages with each
request.Now, use JavaScript to intercept those links and form submissions and
pass the information via
XMLHttpRequest instead. You can then
select which parts of the page need to
be updated instead of updating the
whole page.
I’m a little curious if does that means returning html markups at the server side instead of json, which usually means building the markup on the client side? Is there a disadvantage for this approach?
Also, I notice applications, for instance Facebook, looks pretty crippled when I disabled Javascript (can’t post updates etc.) Does that means that it does not handle graceful degradation properly?
No, it most certainly does not mean that. If JavaScript is disabled, there is no
XMLHttpRequest, so there is no ajax.The JavaScript bits that intercept links and form submissions can freely change where the requests are made, URL parameters, and so on, which means that ajaxified URLs don’t have to be identical to JavaScript-less ones. For example:
could be intercepted and turned into an XMLHttpRequest which is actually made to
/some/page.json, or/some/page.html?ajax=1, or/bibbidi/bobbidi/boo(for all that it matters)