I am not thrilled with the verbosity of jQuery’s ajax syntax. Is it possible to use something other than jQuery when fetching data?
I really like axios as a simple and terse alternative to jQuery.ajax/get/post. It has more options and is much more lightweight than jQuery’s old syntax.
So I tried installing axis.
npm install axios --save
import axios from 'axios';
That didn’t work, and maybe it should have? Build failed, and I’m not sure why.
Thanks @jasonmit. That is close to what I need. Fetch only does one thing, and I like it. Used it for a React project. But it doesn’t solve the other verbs.
The problem with using vanilla js is that then I have to write the VERY verbose syntax of the xmlhttprequest then wrapping it in a Promise. So I may as well just stick with jquery.
You just listed 2 verbs out of 4 that are most used in APIs. Yes, jquery does fine with those 2. It does fine for all of them, except PUT/PATCH makes you define settings and then attach callbacks there.
A library like axios is much more succinct and already written for promises and ES6. Best thing to do? Take @stefan and the ember-cli way and make it installable. A fun endeavor when if I have time. For now I will stick with jquery