POST Form Data as JSON with Fetch API in JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ต.ค. 2024

ความคิดเห็น • 51

  • @ByteGrad
    @ByteGrad  2 ปีที่แล้ว +2

    Hi, mastering JavaScript is critical if you want to be a modern, professional developer: www.udemy.com/course/professional-javascript-course/?referralCode=0C1D5752923168BC87C2
    Also, if you are a front-end developer then mastering CSS (including Flexbox, CSS Grid, etc.) is equally important: www.udemy.com/course/professional-css/?referralCode=4C3C08E82629E6B15752

  • @wickedclamor4882
    @wickedclamor4882 ปีที่แล้ว +3

    First time on your channel but I liked it from the start. Great quality, nice audio, clear voice and content is exactly what the title says. Thank you.

  • @HarisSohail-q4q
    @HarisSohail-q4q ปีที่แล้ว +1

    Man. I am seeing you the first time, and I think you have brilliantly explained the concept. Awesome 💯

  • @Farid9086
    @Farid9086 หลายเดือนก่อน

    Thank you so much my brother ❤

  • @mauricioknabben2793
    @mauricioknabben2793 ปีที่แล้ว +1

    Thank you for all! Greetings from Brasil, this video helped me a lot with a college project

  • @seekknowledge1928
    @seekknowledge1928 หลายเดือนก่อน

    Sir you explain very well. I am amazed. ❤

  • @kavindudilshan8818
    @kavindudilshan8818 10 หลายเดือนก่อน +1

    this is the best video i have fond in youtbe for JSON with Fetch API in JavaScript it is very good

  • @socialpeople6615
    @socialpeople6615 ปีที่แล้ว +1

    Thank you!!! You helped me figure out the FormData.

  • @iv4nschneider
    @iv4nschneider ปีที่แล้ว +1

    Amazing explanation !!! Thank you.

  • @majorcodegeek
    @majorcodegeek ปีที่แล้ว +1

    Your video worked and so simple. Thank you so much

  • @igorvenancio5899
    @igorvenancio5899 ปีที่แล้ว +2

    You're a really good teacher. Thanks

  • @gunnarvispoel581
    @gunnarvispoel581 ปีที่แล้ว +2

    Awesome video, very clear.

  • @ajaygulani3086
    @ajaygulani3086 ปีที่แล้ว +2

    Thank you! this is exactly what I was looking for!

  • @edwintjoa6099
    @edwintjoa6099 2 ปีที่แล้ว +2

    Thanks for your video, you made it so easy to understand and implement.

  • @Hrit
    @Hrit 2 ปีที่แล้ว +1

    Thanks for such a clear explanation!

  • @selsabildjazouli7486
    @selsabildjazouli7486 ปีที่แล้ว +1

    that was soo helpful, thank you

  • @narendrapatil8407
    @narendrapatil8407 ปีที่แล้ว +1

    Thank you it helped me in my project

  • @marynakryvoruchenko1393
    @marynakryvoruchenko1393 ปีที่แล้ว +1

    Thanks for the video! Is there a json file that the information gets stored to so I could display it in another file?

  • @032_jatingaur7
    @032_jatingaur7 ปีที่แล้ว +2

    awesome bro💯

  • @sinki3322
    @sinki3322 ปีที่แล้ว

    When I try to console log my elements, it says « null » and when I try to send them to the api it says « failed to load resource: server responded with 401 ». Do you have ideas on how I could fix it ?
    Thank you for your video

  • @sachinvarma9949
    @sachinvarma9949 10 หลายเดือนก่อน +1

    Thank you so much brotherrr

  • @MohammadhasanAbbasi
    @MohammadhasanAbbasi ปีที่แล้ว +1

    thank you very much for this video

  • @mikempaka6269
    @mikempaka6269 ปีที่แล้ว

    Hi ByteGrad, I'm trying to Post from my Api I created in locahost and I have an '''error of SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data". Can it be possible to Post also in API in localhost?

  • @metifu
    @metifu ปีที่แล้ว

    what about only specific form elements only like "user name" "terms of condition" for the Object?

  • @derrickk2916
    @derrickk2916 ปีที่แล้ว +1

    Very helpful!

  • @troymelok831
    @troymelok831 ปีที่แล้ว

    Hi, thanks for sharing. I don´t understand why is needed to convert to json if we can send FormData directly and then in the php file get data with POST if we use this method to send of course

  • @koenstuurman153
    @koenstuurman153 2 ปีที่แล้ว +2

    Hi, Thanks for the amazing tutorial. I have 1 issue, I did the exact same thing, but I get the "form.html:82 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')" error. What could be the issue here?

    • @ByteGrad
      @ByteGrad  2 ปีที่แล้ว +2

      Hi, probably you didn’t select the HTML-element properly with querySelector

    • @koenstuurman153
      @koenstuurman153 2 ปีที่แล้ว +1

      @@ByteGrad you're right I used id instead of class hehe. Thanks!

  • @MarcelReig
    @MarcelReig ปีที่แล้ว +1

    Thanks, good video!

  • @ibrohimahmadjonov6859
    @ibrohimahmadjonov6859 5 หลายเดือนก่อน

    How the page is not reloading after POST method, i cannot do that, please help

  • @yeonjoon6637
    @yeonjoon6637 ปีที่แล้ว

    Hiii the url u r giving how do I identify how can provide that url!?? Which url nd how can provide it crtly!?

  • @sharathkk1807
    @sharathkk1807 ปีที่แล้ว +1

    thank you so much sir .

  • @muhamadrifqi2612
    @muhamadrifqi2612 ปีที่แล้ว

    Hi, Thank you so much for the amazing tutorial. I have 1 issue, I did the exact same thing, but I get the "crbug/1173575, non-JS module files deprecated." then the page is not working. What could be the issue here?

  • @JoaqoCR7
    @JoaqoCR7 ปีที่แล้ว

    Nice video bro!

  • @StephaniePena-wq3pe
    @StephaniePena-wq3pe ปีที่แล้ว

    Does this code works if I want to make a form that has to use json information ?

  • @aromalunnikrishnan161
    @aromalunnikrishnan161 ปีที่แล้ว +1

    Thank you sir

  • @brains4043
    @brains4043 7 หลายเดือนก่อน +1

    hi! theme name?

  • @Onesmo
    @Onesmo 8 หลายเดือนก่อน

    thank you so much

  • @sumith
    @sumith 2 ปีที่แล้ว +1

    very usful

  • @valdompinga
    @valdompinga ปีที่แล้ว

    What if the data to submit is an array of json's?
    when i send to the backend it gets there on a whole differente format and messes up everything, thank you!

    • @ByteGrad
      @ByteGrad  ปีที่แล้ว

      Hi, I don’t know what an array of json’s. You have a code example?

    • @valdompinga
      @valdompinga ปีที่แล้ว

      @@ByteGrad Hello thanks for answering, my issue is that im trying to post data to a server that expects a JSON array, an exemple of it is: [{name : "Joe"},{name : "Bill"} ], i tested the endpoint using Insomnia REST, posting an hardcoded JSON array and it works fine, but on the frontend code, the js object is stored in variable because i had to do data pre propressing, so when i posted the data, i did: JSON.stringify(varWithPreprocessedJsObject).
      What the server recieved it would be equivalent to {[{"name" : "Joe"},{"name" : "Bill"} ]" : ''}
      So my question is, do identify something i did wrong?
      Sorry for the long text... thank you!

    • @ByteGrad
      @ByteGrad  ปีที่แล้ว

      When you do JSON.stringify() you make it JSON format. Maybe it was already JSON format when you do JSON.stringify()? You would be doubling it

    • @valdompinga
      @valdompinga ปีที่แล้ว +1

      @@ByteGrad BRO, THAT WAS IT!
      Thank you so much man!
      Can i follow u on linkedin?

    • @ByteGrad
      @ByteGrad  ปีที่แล้ว +1

      Nice. It’s a common mistake. Sorry don’t have LinkedIn

  • @Epic_StoriesByPrit
    @Epic_StoriesByPrit 10 หลายเดือนก่อน

    can u make vedios on lua luci cause there is very rare material available one internet

  • @jayroo10
    @jayroo10 ปีที่แล้ว +1

    Hi, are you on UpWork by any chance? as i am trying to fix a piece of code, that needs a "save post" button on the front end, to save response text into a post, it supposed to be straight forward, but I am having trouble with the authenticity token I think, which wont allow the submission to go through. Is there any way to get your help? do you do that kind of thing? thank you

    • @ByteGrad
      @ByteGrad  ปีที่แล้ว +1

      Hi, sorry am completely swamped with work atm

    • @jayroo10
      @jayroo10 ปีที่แล้ว

      @@ByteGrad No worries, and thanks for your reply.