3 ms·
A bit of Ajax here and there is fine. Look at how HN handles it when you upvote/unvote a comment. Look at how old.reddit.com handles it when you click "load m
by JonathanBeuys 4y ago
A bit of Ajax here and there is fine.
Look at how HN handles it when you upvote/unvote a comment.
Look at how old.reddit.com handles it when you click "load more comments" in a long thread.
- basch 4y agoisnt ajax fancy sending html over the wire? or is it just the non fancy way?
- tomjakubowski 4y agoIt's so fancy in fact that it sends xml
- spcebar 4y agoAJAX stands for Asynchronous JavaScript And XML--it was originally designed for asynchronously manipulating XML data using JavaScript because at the time, the future was XML. The act of using JavaScript to send requests is still sometimes referred to as AJAX, despite usually not dealing with XML in any way. The most common use for sending asynchronous requests is making API calls, which today generally return JSON, but you could use AJAX to load HTML and dynamically add it to the page.
- basch 4y agothe person I replied to said "we dont need any of this fancy hotloading" and then gave examples of fancy hotloading, hence me asking, and pointing out the contradiction. Like you said, AJAX isnt limited to XML, and is really just referring to any use of XMLHttpRequest to hotload data whether its XML, JSON etc. I wasnt asking what ajax was. I was asking if it falls into the definition of "fancy." I think my parent proved the opposite point they meant to. old reddit and hn and wp ARE the fancy html over wire sites, and airbnb and reddit are NOT the fancy over wire sites.
- dtech 4y agoAJAX was the original name for doing asynchronous Javascript calls to a server.
- nonethewiser 4y ago> Look at how HN handles it when you upvote/unvote a comment. How?
- IncRnd 4y agoFor me, HN handles votes using deep links, since I have JS disabled.
- BizarreByte 4y agoI’ve never tried it, but my understanding is when JS is disabled HN fires off a GET request (via a link) and returns a 204 to prevent browser navigation, right?
- boredtofears 4y agoInterestingly enough, although javascript gets used, the vote links don't trigger an XHR request - instead the javascript parses the vote URL from the vote button element and then a GET request is made by creating an Image object in JS. You can see votes appear on your network tab under the image tab instead of Fetch/XHR, even though their response return type is text/html -- interesting little hack, although I'm not quite sure why it's done this way instead of fetching since it already requires JS.
- Izkata 4y agoThis is simply how it was done before XMLHttpRequest existed. If it ain't broke don't fix it, I guess.
- deleted 4y ago[deleted]
- IncRnd 4y agoThe vote/downvote buttons do not require JS. You can verify this in the same, under the network tab. There is disallowed JS request, but the vote succeeds independent of the JS not being allowed.