Axios or Ajax in Vue.js to perform requests to the server How can I api?

Asked

Viewed 442 times

0

I have a question I couldn’t solve by searching the Internet. I use ajax to perform requests for a long time, now I’m programming in Vue.js, and I use Xios, I wonder if there is any difference between the 2, which is more ideal, I haven’t been able to create an opinion about it yet. Which do you prefer? I prefer ajax.

  • Vue recommends Xios believe it is because Axios is based on promises.

  • AJAX and Axios are different things. AJAX is the same as asynchronous request. Axios is a library to perform asynchronous requests.

1 answer

2


The acronym Ajax in Portuguese means Javascript and Asynchronous XML. In short, it handles http requests without the need for refresh. In other words any application that uses AJAX can send and receive data from the server without having to reload the full page.


Realize that AJAX is more of a concept, which is implemented by Jquery.
Since Vue.js does not do it natively, it is necessary to use a library, which in this case is Axios.



As for the differential, the fact that it is based on Precedents stands out, but there are several other points that give us more power over the requisitions, for example the intercepts.

Sources:
https://www.hostinger.com.br/tutoriais/o-que-e-ajax/
https://www.npmjs.com/package/axios

Browser other questions tagged

You are not signed in. Login or sign up in order to post.