Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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.


What’s not nice about POST?

    fetch(url, {
      method: “POST”,
      body: “a body”
    })


It has some limitations as well around timeouts, cross site cookies, and progress tracking (uploads, for example).


Sure, but those aren’t common uses for $.ajax. Fetch can get you 95% of the way there.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: