I have a page that uses the jQuery one liner
$('#id').load('/url');
to load a fragment into the DOM at a specific place.
If I want to remove the dependency on jQuery, is there an easy alternative way to do this โ possibly with the relatively new fetch() API?
3
Answers
You can do like this:
Do it like so:
Almost a one liner ๐
to put it to some practical use you’d have at least to check the response code, so I’d first refactor it like this
error handling is still missing, but I’m sure you get the picture ๐