While fetch is wonderful, it isn't a drop in replacement for jQuery's $.get and $.post! It has very different behavior - it doesn't save cookies in a get/post request for example, so it won't work in cases where authentication is required.
fetch also lacks compatibility with older browser versions (such as IE9 and earlier). The compatible way of doing AJAX in pure JS is this (which is relatively less elegant):
While
fetch
is wonderful, it isn't a drop in replacement for jQuery's $.get and $.post! It has very different behavior - it doesn't save cookies in a get/post request for example, so it won't work in cases where authentication is required.fetch
also lacks compatibility with older browser versions (such as IE9 and earlier). The compatible way of doing AJAX in pure JS is this (which is relatively less elegant):