Fetch API in JavaScript for AJAX Developers

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 34

  • @albertalbaba5101
    @albertalbaba5101 2 роки тому +1

    Brother! You maded it so simple that even a kid in prmary school will understand. Thanks

  • @nikhilmwarrier7948
    @nikhilmwarrier7948 3 роки тому +2

    Something I always wanted to know
    Thanks!

  • @pipersaratoga8130
    @pipersaratoga8130 2 роки тому +1

    Thanks! very clear and so beginner friendly

  • @zainabal4667
    @zainabal4667 3 роки тому

    Thank you! I have been trying to understand the difference and you explained it very well.

  • @justnow7263
    @justnow7263 3 роки тому

    Your tutorials are help ful.
    Love from hargiesa somaliland 💕🙏

  • @cmtv357
    @cmtv357 3 роки тому +1

    This is some good stuff. Thanks!

  • @AlThePal78
    @AlThePal78 3 роки тому +1

    Now isnt using ajax allows you to load information without refreshing?

  • @ghassendhaoui2519
    @ghassendhaoui2519 2 роки тому

    i am working on a uni project right now in php and i need to use ajax in some parts, can i use fetch api with database?

  • @nurullahanas4906
    @nurullahanas4906 2 роки тому

    pull data from an external file on desktop with fetch api?

  • @vladosononame6376
    @vladosononame6376 3 роки тому +1

    Thank you for explaination

  • @rangabharath4253
    @rangabharath4253 3 роки тому

    Awesome as always 👍😀

  • @Lymphater
    @Lymphater 2 роки тому

    Nice, but how to use timeout, f.i. if server does not response for >10s ?

  • @KeepLearing
    @KeepLearing 3 роки тому +1

    For me, I understood fetch better than ajax but they don't want me to use fetch! They want me to stick to ajax apparently as ajax will most likely to work all the time but where as fetch won't always be supported due it being newer... 😫

  • @YagamiL
    @YagamiL 2 роки тому +1

    Thanks!
    Could you please include the code under your videos pls? (I mean via a link obviously)

  • @leviuzodike9061
    @leviuzodike9061 Рік тому

    So I understand why there would be an await before a fetch call, but is it really necessary to put an await before the "response.json()"? Wouldn't that function call be instantaneous since it's not getting anything outside of JS? Or do you just put an await before every function call of a promise?

    • @stanley9171
      @stanley9171 Рік тому

      the response.json() method returns a Promise that resolves with the result of parsing the body text as JSON. Therefore, you do need to use await with it to ensure that the parsing completes before the next line of code runs. If you don't use await, the user variable would hold a Promise rather than the actual parsed JSON data.

  • @amirrezaamini9907
    @amirrezaamini9907 3 роки тому +2

    Really thanks! This was exactly what I wanted to learn. One more question, Which of the two last options is the best? (fetch.then or fetch async/await).

    • @dcode-software
      @dcode-software  3 роки тому +3

      All good 🙂 either one is fine, there's no "best" only different ways to do it. If you want wider browser support then stick to .then - check out Can I Use website to see browser compatibility

    • @deewastamang9135
      @deewastamang9135 2 роки тому

      Personally i prefer async/await func as it looks more cleaner. But both are good as they share the same purpose.

    • @amirrezaamini9907
      @amirrezaamini9907 2 роки тому

      @@deewastamang9135 after 11 months lol, now I'm a Senior developer lol. Thanks btw

    • @deewastamang9135
      @deewastamang9135 2 роки тому +1

      @@amirrezaamini9907 That's impressive! Good to know.

  • @k.t.1594
    @k.t.1594 3 роки тому

    Great vid!!

  • @AlThePal78
    @AlThePal78 3 роки тому

    do you just add .json to a link ?

  • @rendykurniawan3998
    @rendykurniawan3998 3 роки тому

    One annoying part about native fetch method, it cant handle file upload progress.

  • @vladosononame6376
    @vladosononame6376 3 роки тому

    What local server you use for this tutorial?

  • @pjmclenon
    @pjmclenon 2 роки тому

    hello reallyawesome explanation ; i get wait and then relation much clearer now and compared to callback ajax; i will keep practicing; i want to maention then these catch error functions i dont like cuz all they do is bring you to the line where the catch code was written not tothe actual line error; so i leave that catch error out so the defaut web console erro bring me to the actial error line; unless you know how to actully display the line error : thxz Lisa

  • @tomytoon123
    @tomytoon123 Рік тому

    thnx this help a log even its already 2023 haha

  • @Videosuser
    @Videosuser 3 роки тому

    Thanks

  • @atmanvisual190
    @atmanvisual190 3 роки тому +1

    Man, I hate ajax. This truly is a game-changer.

  • @Igor34
    @Igor34 3 роки тому +4

    Sorry Ajax, we have to break up