Home > Software design >  Axios | Ajax | Fetch async-await JS | XMLHttpRequest | Which are the best working with PHP?
Axios | Ajax | Fetch async-await JS | XMLHttpRequest | Which are the best working with PHP?

Time:10-18

There are various options:

  • Axios
  • Ajax
  • Fetch
  • XMLHttpRequest

I understand they are all used to fetch data without refreshing the page, but I am confused about which would be better to work with PHP?

CodePudding user response:

Underneath they are all the same technology. Those are just different interfaces to doing the same thing - making an asynchronous HTTP request to the server without refreshing the page.

PHP doesn't know - and doesn't care - which one you use to make your request. All it knows is that a request arrived. How it was generated is not something which matters to it.

That's the beauty of protocols such as HTTP - as long as both client and server understand the protocol, they don't need to care how each other is actually implemented.

  • Related