3 ms·
$.get('test.html', function(r) { window.document.body.className += " done"; }); But: This is not about short code. It's about readability. What's r
by WA 14y ago
$.get('test.html', function(r) {
window.document.body.className += " done";
});
But: This is not about short code. It's about readability. What's readyState 4? Why "open" a request before sending it?
- shuzchen 14y agoIt gets even messier when you find out one day you have to handle failures, or serialize data to send to that endpoint, or get notified on network events, or cancel an ongoing request, or etc etc etc.
- grannyg00se 14y agoMy code is a response to neya's comment. It's not about short code or readability. It's about demonstrating that neya's example has completely unreasonable non-jQuery code given the jQuery code it is being compared against.