Sending JavaScript Http Requests with Axios

Sdílet
Vložit
  • čas přidán 22. 09. 2019
  • 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.com/learn/javas...
    #2 - Using the fetch() API: www.academind.com/learn/javas...
    #3 (this video) - Using Axios: academind.com/learn/javascrip...
    Check out all our other courses: academind.com/learn/our-courses
    Starting Code for the series: github.com/academind/xhr-fetc...
    Starting Code for this video: github.com/academind/xhr-fetc...
    Finished Code: github.com/academind/xhr-fetc...
    ----------
    • 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!
  • Věda a technologie

Komentáře • 106

  • @shachaha
    @shachaha Před 4 lety +11

    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! :)

  • @Raghad-mz8el
    @Raghad-mz8el Před 3 lety +8

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

  • @golamrabbiazad
    @golamrabbiazad Před 4 lety +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 Před 4 lety +12

    one year + with axios . love it!

  • @leonvanrijswijk8409
    @leonvanrijswijk8409 Před 4 lety +36

    Thanks, this was a really helpfull mini series

  • @kiana5066
    @kiana5066 Před 4 lety +3

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

  • @talkohavy
    @talkohavy Před 3 lety +1

    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 ;)

  • @mosscliffe
    @mosscliffe Před 4 lety +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  Před 4 lety +1

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

  • @CodeWithBehram7497
    @CodeWithBehram7497 Před 3 měsíci

    4 years old video but taught simply and straight forward❤

  • @rongliao9255
    @rongliao9255 Před 4 lety

    Great tutorial! Love the syntax of Axios!

  • @PawanKumar-tu6ti
    @PawanKumar-tu6ti Před 3 lety

    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!

  • @morigene
    @morigene Před 4 lety +1

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

  • @emmanuelanthonyfermin7853

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

  • @rodrigocabral7856
    @rodrigocabral7856 Před 8 měsíci

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

  • @apenet-
    @apenet- Před 3 lety

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

  • @XnonXte
    @XnonXte Před 9 měsíci

    Straight into the points, really helpful!

  • @dror-krief
    @dror-krief Před 4 lety +1

    Thanks for this videos.
    This video is fantastic!

  • @ojarrellpro
    @ojarrellpro Před 4 lety

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

  • @arunkutz
    @arunkutz Před 3 lety

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

  • @ianlimasouza6896
    @ianlimasouza6896 Před 2 lety

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

  • @Sam0_21_
    @Sam0_21_ Před 11 měsíci

    thank you for the beautiful and simple explanation

  • @InsEngineered
    @InsEngineered Před 3 lety

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

  • @TeoAlmonte
    @TeoAlmonte Před 4 lety +1

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

    • @academind
      @academind  Před 4 lety +1

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

  • @dhokiarinidh9809
    @dhokiarinidh9809 Před rokem

    Thank you sir, we really appreciate your generosity

  • @markbogdan2
    @markbogdan2 Před 3 lety +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?

  • @germanmartirosyan6230
    @germanmartirosyan6230 Před 4 lety

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

  • @marcvancauwenberghe7511

    Great mini series!!!

  • @paymankhayree8552
    @paymankhayree8552 Před 4 lety +1

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

  • @conorbyrne3519
    @conorbyrne3519 Před 4 lety

    This video is fantastic! Cheers

  • @VKD007
    @VKD007 Před 4 lety

    i forgot how to use axios thanks for revision man

  • @saadidrees7791
    @saadidrees7791 Před 3 lety

    best video on youtube about axios

  • @MOGE_
    @MOGE_ Před rokem

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

  • @codingcomponents
    @codingcomponents Před 4 lety

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

  • @robilaqaiser1984
    @robilaqaiser1984 Před 4 lety

    Thnx sir for such a great tutorials

  • @kazeemodutola9617
    @kazeemodutola9617 Před 3 lety +1

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

  • @101appsCoZa
    @101appsCoZa Před 4 lety

    Great tutorial. thanks!

  • @hleet
    @hleet Před 4 lety

    thx for this video ! very helpful

  • @_renamed_
    @_renamed_ Před 3 lety

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

  • @jorgeperalta9780
    @jorgeperalta9780 Před 4 lety

    What a great mini-series

  • @mooodddy1
    @mooodddy1 Před 4 lety

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

  • @JorgeGiro
    @JorgeGiro Před 4 lety

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

    • @sonnybrown4758
      @sonnybrown4758 Před 2 lety

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

  • @sky_kryst
    @sky_kryst Před 4 lety

    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?

  • @talkohavy
    @talkohavy Před 3 lety +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?

  • @ivanshoshkov
    @ivanshoshkov Před 2 lety

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

  • @miguelarly
    @miguelarly Před 4 lety

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

  • @user-iu5vm7qh6k
    @user-iu5vm7qh6k Před 4 lety

    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?

  • @bibasniba1832
    @bibasniba1832 Před 3 lety

    Thank you Mister!

  • @greenshaheen6716
    @greenshaheen6716 Před 4 lety

    U r an awesome instructor !!

  • @MontyKsycki
    @MontyKsycki Před 4 lety

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

  • @mertsevtekin1287
    @mertsevtekin1287 Před 3 lety

    Great video!

  • @Lbmaniak
    @Lbmaniak Před 4 lety +1

    Usefully video

  • @aniketgupta6505
    @aniketgupta6505 Před 4 lety +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.

  • @mayarjaba6731
    @mayarjaba6731 Před rokem

    what a leason♥
    thanks you♥♥

  • @00el04
    @00el04 Před 3 lety +1

    Thank you!

  • @tdK85
    @tdK85 Před 4 lety

    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

  • @anuj7286
    @anuj7286 Před 3 lety

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

  • @coderlicious6565
    @coderlicious6565 Před 6 měsíci

    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.

  • @SwapnilLonkar
    @SwapnilLonkar Před 3 lety

    Really helpfull. Thanks ✌

  • @ariel._.9186
    @ariel._.9186 Před 2 lety

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

  • @samayunmiahchowdhury794

    Deserves 1 crore love react ...

  • @albertchung7641
    @albertchung7641 Před 4 lety

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

  • @sanyuktakate4099
    @sanyuktakate4099 Před 4 lety

    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?

  • @vikasswamy3498
    @vikasswamy3498 Před 2 lety

    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

  • @drarxonwarlock9874
    @drarxonwarlock9874 Před 4 lety

    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  Před 4 lety

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

  • @jorgedavalos5663
    @jorgedavalos5663 Před 2 lety

    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. =(

  • @nikosspiropoulos8417
    @nikosspiropoulos8417 Před 4 lety

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

  • @keys3340
    @keys3340 Před 3 lety

    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

  • @ahtshamrao7083
    @ahtshamrao7083 Před 4 lety

    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.

  • @alihusham1560
    @alihusham1560 Před 3 lety

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

  • @dimitrisandroid6483
    @dimitrisandroid6483 Před 4 lety

    Thank you !!!

  • @Cdswjp
    @Cdswjp Před 2 lety

    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.

  • @JoeWong81
    @JoeWong81 Před 4 lety +2

    ACADEMIND RULES!!!

  • @mv8167
    @mv8167 Před 2 lety

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

  • @kisoresubburaman7945
    @kisoresubburaman7945 Před 4 lety

    Sir!! please do video for React360

  • @ridwanhaqi6834
    @ridwanhaqi6834 Před 2 lety

    i wonder how to catch error from validator of laravel api

  • @syrine5560
    @syrine5560 Před 2 lety

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

  • @rainbow-jw3og
    @rainbow-jw3og Před 3 lety

    i need example for send for post body please

  • @GAMEPOTA
    @GAMEPOTA Před 3 lety

    How about sending an objects list?

  • @AlThePal78
    @AlThePal78 Před 3 lety

    I would have liked to see axios with async

  • @dell4559
    @dell4559 Před 2 lety

    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

  • @simonx3088
    @simonx3088 Před 4 lety +2

    CROS problem get me crazy ,pls !help me!

  • @dzun_nn
    @dzun_nn Před 4 lety

    may I request for axios with svelte ?

  • @vincesanchez7790
    @vincesanchez7790 Před 4 lety

    Use Axios in all projects cause it supports all browsers

  • @AstroSardaukar
    @AstroSardaukar Před 4 lety

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

    • @academind
      @academind  Před 4 lety +1

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

  • @BryanChance
    @BryanChance Před 2 lety

    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

  • @bahaaaldeen9611
    @bahaaaldeen9611 Před rokem

    awesome

  • @manuelfleri88
    @manuelfleri88 Před 4 lety

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

  • @bessamlegrand
    @bessamlegrand Před 3 lety

    Max i love you brother

  • @projectxny
    @projectxny Před 4 lety +1

    Finally..

  • @ioannisme7495
    @ioannisme7495 Před 4 lety

    i love axios

  • @RahulKumar-rk1tf
    @RahulKumar-rk1tf Před 4 lety +1

    Any suggestions for jQuery AJAX?

  • @robbradley1337
    @robbradley1337 Před 4 lety +1

    Re gister lol

  • @daniyaltayyab2379
    @daniyaltayyab2379 Před rokem

    waste of time dont watch it

  • @fieryninja2374
    @fieryninja2374 Před 11 měsíci

    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 Před 4 lety +4

    Thanks, this was a really helpfull mini series