Sending JavaScript Http Requests with Axios

Поделиться
HTML-код
  • Опубликовано: 13 сен 2024
  • Want to send some background (Ajax) Http requests with JavaScript? Learn how to use Axios for that!
    Join the full "JavaScript - The Complete Guide" course: acad.link/js
    Exclusive Discount also available for my "Accelerated ES6 Training" Course: acad.link/es6
    THIS VIDEO IS PART OF A MINI-SERIES! Check out the other parts:
    #1 - Using XMLHttpRequest: www.academind....
    #2 - Using the fetch() API: www.academind....
    #3 (this video) - Using Axios: academind.com/...
    Check out all our other courses: academind.com/...
    Starting Code for the series: github.com/aca...
    Starting Code for this video: github.com/aca...
    Finished Code: github.com/aca...
    ----------
    • Go to www.academind.com and subscribe to our newsletter to stay updated and to get exclusive content & discounts
    • Follow @maxedapps and @academind_real on Twitter
    • Follow @academind_real on Instagram: / academind_real
    • Join our Facebook community on / academindchannel
    See you in the videos!
    ----------
    Academind is your source for online education in the areas of web development, frontend web development, backend web development, programming, coding and data science! No matter if you are looking for a tutorial, a course, a crash course, an introduction, an online tutorial or any related video, we try our best to offer you the content you are looking for. Our topics include Angular, React, Vue, Html, CSS, JavaScript, TypeScript, Redux, Nuxt.js, RxJs, Bootstrap, Laravel, Node.js, Progressive Web Apps (PWA), Ionic, React Native, Regular Expressions (RegEx), Stencil, Power BI, Amazon Web Services (AWS), Firebase or other topics, make sure to have a look at this channel or at academind.com to find the learning resource of your choice!

Комментарии • 107

  • @shachaha
    @shachaha 4 года назад +12

    This was really informative. I learned Axios first and was like: Okay, this is how you make Get/Post requests. Fine. But learning about XMLhttpsrequests and fetch and the pain, that can come with it, lets me worship Axios even more and I understood, what Axios actually is doing for me! I love your content. Your the best explainer I have found so far. Keep it up! :)

  • @golamrabbiazad
    @golamrabbiazad 5 лет назад +31

    I think axios is beginner friendly and easy to use than fetch, XMLHttpRequest. Thank you sir, for the mini series. Love it.

  • @djpacu
    @djpacu 5 лет назад +12

    one year + with axios . love it!

  • @leonvanrijswijk8409
    @leonvanrijswijk8409 5 лет назад +36

    Thanks, this was a really helpfull mini series

  • @Raghad-mz8el
    @Raghad-mz8el 3 года назад +8

    This was extremely helpful. You’re my web development superhero seriously thank you so much

  • @mosscliffe
    @mosscliffe 5 лет назад +1

    This guy is very good. Highly recommended.
    I had no idea where to start in accessing a remote site for data, which I needed to do - and now I have three options.
    Many thanks

    • @academind
      @academind  5 лет назад +1

      Thank you, this really means a lot to me :)

  • @CodeWithBehram7497
    @CodeWithBehram7497 6 месяцев назад

    4 years old video but taught simply and straight forward❤

  • @talkohavy
    @talkohavy 3 года назад +2

    Great video!
    I'm trying to convince the people I work with to switch to Axios from fetch,
    and i'm using your mini-series as a tool to win the debate ;)

  • @rodrigocabral7856
    @rodrigocabral7856 10 месяцев назад

    everything u need to know about this library. Very good video

  • @kiana5066
    @kiana5066 4 года назад +3

    Actually yes, this was helpful in my project. Thank you so much!

  • @ianlimasouza6896
    @ianlimasouza6896 3 года назад

    is it possible to like this series twice? I would. Dude, THANK YOU

  • @MOGE_
    @MOGE_ Год назад

    Whenever I get mad at Axios, I will remember this video and the amount of pain it is saving me from.

  • @Sam0_21_
    @Sam0_21_ Год назад

    thank you for the beautiful and simple explanation

  • @TeoAlmonte
    @TeoAlmonte 5 лет назад +1

    Great mini series! always enjoy going back to basics and getting a refresher. Very well explained.

    • @academind
      @academind  5 лет назад +1

      Happy to read that you like it Teo, thank you :)

  • @talkohavy
    @talkohavy 3 года назад +3

    Question:
    What if I want to use Axios,
    but also use the "await", rather than ".then" and ".catch".
    Is there a way to catch the error then?

  • @XnonXte
    @XnonXte Год назад

    Straight into the points, really helpful!

  • @morigene
    @morigene 4 года назад +1

    Very great content. It really touches the point I needed. Thanks keep up

  • @PawanKumar-tu6ti
    @PawanKumar-tu6ti 3 года назад

    Thanks a ton for this amazing content, and by the way, I love your smile brother, when you smile, it makes me smile with you!

  • @apenet-
    @apenet- 3 года назад

    Looks super useful. I find myself writing a lot of error checking when using fetch.

  • @rongliao9255
    @rongliao9255 5 лет назад

    Great tutorial! Love the syntax of Axios!

  • @saadidrees7791
    @saadidrees7791 3 года назад

    best video on youtube about axios

  • @emmanuelanthonyfermin7853
    @emmanuelanthonyfermin7853 3 года назад

    A big thanks, you are really good at explaining this in detail

  • @paymankhayree8552
    @paymankhayree8552 4 года назад +1

    beyond perfect. I am also doing your angular course on Udemy and it has already been a great help

    • @academind
      @academind  4 года назад

      Thanks so much Payman!

  • @dror-krief
    @dror-krief 4 года назад +1

    Thanks for this videos.
    This video is fantastic!

  • @arunkutz
    @arunkutz 3 года назад

    Thank you .. Very helpful video ... Just love the way you explain the usages ... :)

  • @marcvancauwenberghe7511
    @marcvancauwenberghe7511 3 года назад

    Great mini series!!!

  • @dhokiarinidh9809
    @dhokiarinidh9809 Год назад

    Thank you sir, we really appreciate your generosity

  • @InsEngineered
    @InsEngineered 3 года назад

    This was a much-needed comparison. If possible can you also make content regarding CORS proxy?

  • @QaisZayed.work90
    @QaisZayed.work90 Месяц назад

    Thank you so much you just simplify it for me

  • @markbogdan2
    @markbogdan2 3 года назад +1

    Wonderful video. It explains a lot about axios and helped me a lot in my project. I have one question though. On all major sites most of the requests to the APIs are not visible in the network tab. Is this possible with axios, or is there another method?

  • @jorgeperalta9780
    @jorgeperalta9780 4 года назад

    What a great mini-series

  • @kazeemodutola9617
    @kazeemodutola9617 3 года назад +1

    Thank you for this tutorial! How can we handle file upload, through axios ?

  • @JorgeGiro
    @JorgeGiro 4 года назад

    Thank you for the very good tutorials. Axios is on average 8 to 9 times slower than the other 2 methods.

    • @sonnybrown4758
      @sonnybrown4758 3 года назад

      Where did you hear that? I’d really like to know.

  • @aniketgupta6505
    @aniketgupta6505 4 года назад +2

    I got an error origin '127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

  • @conorbyrne3519
    @conorbyrne3519 4 года назад

    This video is fantastic! Cheers

  • @user-iu5vm7qh6k
    @user-iu5vm7qh6k 4 года назад

    Searching for aoxis api and found this and found u are Maximiliam I just registered ur react course on udemy!! What a surprise!
    Will react js need to use aoxis api?

  • @VKD007
    @VKD007 4 года назад

    i forgot how to use axios thanks for revision man

  • @ariel._.9186
    @ariel._.9186 2 года назад

    thanks, now, i know why i have to use axios

  • @_renamed_
    @_renamed_ 4 года назад

    thanks for this video, can you show how to use chaining in get requests?

  • @JoeWong81
    @JoeWong81 5 лет назад +2

    ACADEMIND RULES!!!

  • @coderlicious6565
    @coderlicious6565 9 месяцев назад

    The one thing that drove me nuts with fetch is that it's almost impossible to run a post on your backend api ( php in my case ) and then get back the response ( a specific error message that I return from my php backend function ).
    With jquery $.post never had a problem, but of course jquery is old.. so I need to learn to use axios.

  • @mertsevtekin1287
    @mertsevtekin1287 3 года назад

    Great video!

  • @germanmartirosyan6230
    @germanmartirosyan6230 5 лет назад

    Thanks for this videos, i had a question what to use, now i get an answer)

  • @ivanshoshkov
    @ivanshoshkov 3 года назад

    I have Max's react course and it wonderfull! I highly recommend it.

  • @sky_kryst
    @sky_kryst 5 лет назад

    Hey I've completed your reactjs course on udemy and came to know about Meteorjs from another site. Just wanted to ask when will you talking about it? Explain what it is and how well does it go with react?

  • @miguelarly
    @miguelarly 4 года назад

    Excellent!! Where did you get the page showed at 2:25?

  • @Lbmaniak
    @Lbmaniak 5 лет назад +1

    Usefully video

  • @101appsCoZa
    @101appsCoZa 5 лет назад

    Great tutorial. thanks!

  • @robilaqaiser1984
    @robilaqaiser1984 4 года назад

    Thnx sir for such a great tutorials

  • @hleet
    @hleet 4 года назад

    thx for this video ! very helpful

  • @bibasniba1832
    @bibasniba1832 4 года назад

    Thank you Mister!

  • @greenshaheen6716
    @greenshaheen6716 5 лет назад

    U r an awesome instructor !!

  • @00el04
    @00el04 3 года назад +1

    Thank you!

  • @mayarjaba6731
    @mayarjaba6731 2 года назад

    what a leason♥
    thanks you♥♥

  • @BryanChance
    @BryanChance 3 года назад

    XMLHttpRequest is fine. I don’t see why so many wrappers and wrappers of the wrapper. It actually makes code harder to understand when there are many hidden or behind the scene “magic”. I load up a single webpage and it uses gobs of memory. People are so spoiled these days. LOL

  • @simonx3088
    @simonx3088 4 года назад +2

    CROS problem get me crazy ,pls !help me!

  • @AlThePal78
    @AlThePal78 3 года назад

    I would have liked to see axios with async

  • @mooodddy1
    @mooodddy1 5 лет назад

    Thanks, this was a really helpfull
    Please max explain http2 ?

  • @anuj7286
    @anuj7286 3 года назад

    Sir i am little confused which one should i use Axios, fetch api or asynchronous function to get data and post data?

  • @vincesanchez7790
    @vincesanchez7790 4 года назад

    Use Axios in all projects cause it supports all browsers

  • @tdK85
    @tdK85 4 года назад

    Hey, could you help me? I'm trying to calling an API Post with a huge object in the body. Getting your example as a example, I need to declare each parameter of my object in the body of Axios? Thanks

  • @ridwanhaqi6834
    @ridwanhaqi6834 3 года назад

    i wonder how to catch error from validator of laravel api

  • @nikosspiropoulos8417
    @nikosspiropoulos8417 4 года назад

    why the data on the api included the id and not the email and the password you posted? cannot understand it

  • @SwapnilLonkar
    @SwapnilLonkar 3 года назад

    Really helpfull. Thanks ✌

  • @GAMEPOTA
    @GAMEPOTA 3 года назад

    How about sending an objects list?

  • @jorgedavalos5663
    @jorgedavalos5663 2 года назад

    any one knows, why a response from an update, only show for less than a second on the console? im sending from express a mysql affectedrow message converted to json, but, once it gets to the frontend, it's only display for less than a second. =(

  • @vikasswamy3498
    @vikasswamy3498 2 года назад

    I have an array with values like usernames .. can we make axios get request on a condition ie., get data from url where username matches to our array values

  • @sanyuktakate4099
    @sanyuktakate4099 4 года назад

    How to solve the 401 unathorized error? Do I need to use tokens generated from the server side that I need to pass into the header?

  • @drarxonwarlock9874
    @drarxonwarlock9874 5 лет назад

    Could you do a video "10 things a webdeveloper should know" or something similar to this or do you already have some kind of videos like that?

    • @academind
      @academind  5 лет назад

      This might be what you're looking for => academind.com/learn/web-dev/how-to-become-a-better-web-developer/

  • @codingcomponents
    @codingcomponents 4 года назад

    Thank you so much, it's really helpful. May God give you more success in your life. :-)

  • @rainbow-jw3og
    @rainbow-jw3og 3 года назад

    i need example for send for post body please

  • @syrine5560
    @syrine5560 3 года назад

    is it possible to use axios to create a video chat app?

  • @albertchung7641
    @albertchung7641 4 года назад

    Hello, how come I can't use the `import * as axios from axios` syntax with Node? ES6 import isn't natively supported yet?

  • @AstroSardaukar
    @AstroSardaukar 4 года назад

    Not a single thumb down? I was almost tempted to give the first! :)

    • @academind
      @academind  4 года назад +1

      Very happy to get such an incredible feedback, please don't be the first with the thumb down here ;)

  • @keys3340
    @keys3340 3 года назад

    Sir .. i can't access the axios object in my js file even i do the same as you in the importation of the unpkg link ?? am i missing something

  • @Cdswjp
    @Cdswjp 3 года назад

    Hello. Can you please help me.
    I need to upload a file of source code. The source code is already compressed, and I want to upload it compressed, as it already is, to the server. I'm in the process of trying to figuring which headers (& their respective values) I must set on client side, & which ones I must set at server.
    I want to send the zipped file to the server & get it back from the server zipped also.
    I believe these are the only headers I will need to choose from: Content-Type, Accept-Encoding, Content-Encoding, Accept-Type
    I just need to configure them correctly, then I am done.
    Cheers.

  • @MontyKsycki
    @MontyKsycki 4 года назад

    Thank You!!! :) Have a Great Day!! Enjoy ~ Peace :)

  • @alihusham1560
    @alihusham1560 4 года назад

    when i dot axios.post() , i get new element with only _id, without the data that I specified?

  • @mv8167
    @mv8167 2 года назад

    Can we pull the API (json format) execution time from Axios?

  • @ahtshamrao7083
    @ahtshamrao7083 4 года назад

    hay will you please tell us how to disable ssl cert error in axios.
    api that I'm trying to get data from has ssl enable on it and when i hit tha api from axios it says ssl cert error.

  • @samayunmiahchowdhury794
    @samayunmiahchowdhury794 5 лет назад

    Deserves 1 crore love react ...

  • @dimitrisandroid6483
    @dimitrisandroid6483 5 лет назад

    Thank you !!!

  • @kisoresubburaman7945
    @kisoresubburaman7945 5 лет назад

    Sir!! please do video for React360

  • @dell4559
    @dell4559 2 года назад

    Can anyone please help me how to get single data from get request
    Means /posts/1 where 1 can be 2 3 ... passing a variable and works according to the id ??
    Please help me I am in real trouble I need to submit my project this week

  • @dzun_nn
    @dzun_nn 4 года назад

    may I request for axios with svelte ?

  • @ioannisme7495
    @ioannisme7495 4 года назад

    i love axios

  • @bessamlegrand
    @bessamlegrand 3 года назад

    Max i love you brother

  • @manuelfleri88
    @manuelfleri88 4 года назад

    Would it be possible to know which IDE are you using for these videos?

    • @academind
      @academind  4 года назад

      I use Visual Studio Code.

    • @manuelfleri88
      @manuelfleri88 4 года назад

      @@academind Thank you very much!

  • @projectxny
    @projectxny 5 лет назад +1

    Finally..

  • @bahaaaldeen9611
    @bahaaaldeen9611 Год назад

    awesome

  • @RahulKumar-rk1tf
    @RahulKumar-rk1tf 5 лет назад +1

    Any suggestions for jQuery AJAX?

  • @robbradley1337
    @robbradley1337 5 лет назад +1

    Re gister lol

  • @daniyaltayyab2379
    @daniyaltayyab2379 2 года назад

    waste of time dont watch it

  • @fieryninja2374
    @fieryninja2374 Год назад

    I am using a react app and I always get thrown an AxiosError with this piece of code:
    ```
    const { mutate, data, isError, error } = useMutation({
    mutationFn: (params: UserRegisterType) => {
    return axios
    .post("/api/auth/register", params)
    .then((res) => res.data);
    }
    });
    ```
    I am using tanstack query so it can handle error states, loading states, and more. But I tried it without tanstack and the issue still persists.
    ```
    axios.post("/api/auth/register", params) .then((res) => res.data);
    ```
    I am sure this is correct but I still get the error. Also I know it is not the url because when I check the console it shows the url of the api and because I am hosting my app locally it is localhost:3000/api/auth/register.
    Any help will be appriciated

  • @juhandvan
    @juhandvan 5 лет назад +4

    Thanks, this was a really helpfull mini series

  • @ojarrellpro
    @ojarrellpro 4 года назад

    Super awesome sir! and so timely for me... thank you!