News for hackers. Stuff that matters.
Re:How to manage HTML DOM with vanilla JavaScript only? by untog on Thursday April 02, 2020 @09:23AM (#22758640)
For me the Fetch API is basically that:

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

    fetch("http://www.example.com").then(res => res.json()).then(json => {})
Only big downside is no IE11 support but thankfully I don't have to worry about that so much these days.
Re:How to manage HTML DOM with vanilla JavaScript only? by leetrout on Thursday April 02, 2020 @09:40AM (#22758806)
It still doesn't go POST in a nice way like the jQuery API does BUT it is not worth bringing jQuery to the page just for making requests with slightly nicer syntax.
Re:How to manage HTML DOM with vanilla JavaScript only? by untog on Thursday April 02, 2020 @09:56AM (#22758960)
What’s not nice about POST?

    fetch(url, {
      method: “POST”,
      body: “a body”
    })
Re:How to manage HTML DOM with vanilla JavaScript only? by tyingq on Thursday April 02, 2020 @09:51AM (#22758914)
It has some limitations as well around timeouts, cross site cookies, and progress tracking (uploads, for example).
Re:How to manage HTML DOM with vanilla JavaScript only? by untog on Thursday April 02, 2020 @09:55AM (#22758948)
Sure, but those aren’t common uses for $.ajax. Fetch can get you 95% of the way there.