Sending Form Data (POST) with the Fetch API in JavaScript

  Рет қаралды 203,376

dcode

dcode

Күн бұрын

Пікірлер: 90
@dcode-software
@dcode-software 2 жыл бұрын
*RELATED VIDEO: UPLOAD FILES WITH THE FETCH API* kzbin.info/www/bejne/mZbMY3aea51mp5I 🏷 *THE ULTIMATE JAVASCRIPT DOM CRASH COURSE* 👇 www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1
@webdev4786
@webdev4786 3 жыл бұрын
people like you are making the world a better place.
@karentutor5470
@karentutor5470 4 жыл бұрын
Thx for this I honestly spent a long time looking for a simple way to submit form data using the fetch api - this fits the bill. Thanks again for the great tutorial!
@1000hourshower
@1000hourshower Жыл бұрын
You helped me out big time. You're the only chap on here making sense with this matter. Thanks.
@Lord-v2s
@Lord-v2s 3 жыл бұрын
Please help me, I keep getting an *http 405 (Method not Allowed)* error when I run my project. What do I do? Do I have to change something in *Xampp*?
@holup5035
@holup5035 2 жыл бұрын
same
@Levelord92
@Levelord92 5 жыл бұрын
Fucking awesome dude! I finally understand that FormData is an analog for jquery's serialize() form and pushing it into array, which we then send with data key.
@dcode-software
@dcode-software 5 жыл бұрын
Yeah that's it mate!!
@Unerty
@Unerty 4 жыл бұрын
If you get an error "Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'", then replace const formData = new FormData(this); with const formData = new FormData(HERE_PUT_YOUR_FORM_OBJECT); For example, i if you have const myForm = document.getElementById("myForm"); then put const formData = new FormData(myForm);
@basselturky4027
@basselturky4027 2 жыл бұрын
Thank you legend
@akshitkhajuria4362
@akshitkhajuria4362 4 жыл бұрын
Great tut. But you should never send sensitive info like passwords as URL encoded strings. Use POST with https instead. POST method doesn't encode query params in the url.
@inteltone
@inteltone Жыл бұрын
Thanks a lot for this video tutorial! It is very useful.
@davidmajdandzic7388
@davidmajdandzic7388 3 жыл бұрын
Thank you so much! Your video just ended hours of head scratching and screaming swear words! 🥳
@hoo_chuchu_0901
@hoo_chuchu_0901 4 жыл бұрын
고맙다!! 당신 덕분에 문제를 해결했다. 중요한내용을 확실히 집어주는 당신은 정말 최고! 나의 스승이 되어줘! Thank you !! You solved the problem. You are really nice guy! Be my teacher!
@stepdate
@stepdate 4 жыл бұрын
Thank you, this was extremely helpful!
@tamas-pamas
@tamas-pamas 5 жыл бұрын
When would you use urlencoded form data and multipart form data? what is the point to parse into URLSearchParams object? To me it is just an extra step
@bjornleonhenry9750
@bjornleonhenry9750 5 жыл бұрын
your videos are explosive 💥 coding dynamite
@coredatallc5671
@coredatallc5671 4 жыл бұрын
Very nice video. Now extend this to include MySQL query response using PDO and you will have a gem.
@cjmarchi
@cjmarchi 5 жыл бұрын
simple and 100% working solution. Tks :)
@dcode-software
@dcode-software 5 жыл бұрын
No problem :)
@steveg917
@steveg917 5 жыл бұрын
not 100%.. the "this" go to the window.. you need to bind it
@hitsu-kun
@hitsu-kun 3 жыл бұрын
Thanks so much! You save my day
@sir.charless.7443
@sir.charless.7443 4 жыл бұрын
you didn't show the php file, how do use the the data sended?
@dcbiz
@dcbiz 3 жыл бұрын
Very helpful and much appreciated.
@randomvideoguy3340
@randomvideoguy3340 4 жыл бұрын
I love you for posting this ty so much
@dcode-software
@dcode-software 4 жыл бұрын
No worries mate 😁
@pastorfred2543
@pastorfred2543 4 жыл бұрын
Wow..This is super useful.. Thanks
@madsnielsen9295
@madsnielsen9295 5 жыл бұрын
Thank you very much for this tutorial. Can i ask what kind of parameter type would my restful API POST request need?
@olifer-br
@olifer-br 3 жыл бұрын
Awesome! Thank you
@arashnikbakht129
@arashnikbakht129 4 жыл бұрын
Great video, how can we send inputs like this one
@nidhishettigar6981
@nidhishettigar6981 3 жыл бұрын
I am getting error - uncaught typeerror cannot read properties of null(reading addeventlisterner) . This is for variable myform. How can i solve this error please help!!!
@angladephil
@angladephil 5 жыл бұрын
Thank you very much for this and your other tutorials, which I follow with great attention and benefit ! Sorry I come late after this video, but I have a question : how to handle so simply the FormData object (and it's data) without PHP? For example through Node.js ? Thank you in advance . Greetings from France.
@guruprasadhmathivanan4040
@guruprasadhmathivanan4040 3 жыл бұрын
Hi sir I'm guruprasadh
@guruprasadhmathivanan4040
@guruprasadhmathivanan4040 3 жыл бұрын
From india
@guruprasadhmathivanan4040
@guruprasadhmathivanan4040 3 жыл бұрын
I've created an rest api using spring boot
@guruprasadhmathivanan4040
@guruprasadhmathivanan4040 3 жыл бұрын
But I give value using postman
@muhammadzubair4754
@muhammadzubair4754 4 жыл бұрын
how to load html form data using json data file?
@IBITZEE
@IBITZEE 4 жыл бұрын
a teaser... strictly at client side (no control over the server...) I need to pass the form data from one page to the next called page... but with (yeah,,, with post) I know I can do it via GET/parms-in-url via H5/localStorage or via H5/sessionStorage... but??? is there anyway to do it with POST/action??? the form information/fields,,, of course are in the HTTP headers...
@kolinsukhadia3219
@kolinsukhadia3219 3 жыл бұрын
array(0){ } server show this so what I have to do to solve this error?
@luismaestro23
@luismaestro23 3 жыл бұрын
what about the php file where you recieve the formdata
@syrymzhakypbekov1949
@syrymzhakypbekov1949 4 жыл бұрын
very informative !
@brunogigliofreitas
@brunogigliofreitas 3 жыл бұрын
The "this" didnt work for me
@holup5035
@holup5035 2 жыл бұрын
you probably used arrow function in addEventListener
@dipzera1025
@dipzera1025 4 жыл бұрын
How would you combine this with validation?
@troonder6274
@troonder6274 Жыл бұрын
NICE NICE NICE, thanks ^^
@bryandelacruz9066
@bryandelacruz9066 5 жыл бұрын
thanks do you also have a code for edit and delete? thanks
@handersenadriano1309
@handersenadriano1309 5 жыл бұрын
thanks very much
@dcode-software
@dcode-software 5 жыл бұрын
No worries mate!
@jeremiahjohnson1594
@jeremiahjohnson1594 4 жыл бұрын
this is with php...what of js
@guruprasadhmathivanan4040
@guruprasadhmathivanan4040 3 жыл бұрын
How to send form data using fetch api with raw data
@shazythings8798
@shazythings8798 2 жыл бұрын
Helpful
@kemmrthappy2804
@kemmrthappy2804 5 жыл бұрын
thanks a bit can u try out using fetch api with a input type=file
@naomifeedcow
@naomifeedcow 4 жыл бұрын
Awesome!
@robitops1547
@robitops1547 4 жыл бұрын
Thanks but input:file return Object not value
@s.agamerz7962
@s.agamerz7962 3 жыл бұрын
What a typing speed
@dcode-software
@dcode-software 3 жыл бұрын
👀👀👀
@WebdesignemFoco
@WebdesignemFoco 3 жыл бұрын
Wonderfull
@ajmalnajath1399
@ajmalnajath1399 3 жыл бұрын
this is keybaord asmr
@vazhamikadze4018
@vazhamikadze4018 2 жыл бұрын
Thanks
@allandiego1446
@allandiego1446 4 жыл бұрын
If I put in with the empty action is correct too?
@ulvidamirli2758
@ulvidamirli2758 4 жыл бұрын
Yes, e.preventDefault() ignores it.
@deepumon.d3148
@deepumon.d3148 4 жыл бұрын
You didn't showed data s in console.log()
@cat-typing2803
@cat-typing2803 4 жыл бұрын
Don't use arrow function in addEventListener
@dopamine_Seeker
@dopamine_Seeker 3 жыл бұрын
not working I am furious in my local host $_post not working as I expected
@epickaowca8850
@epickaowca8850 5 жыл бұрын
canno't post /login.php POST 404 not found can some one help me ?
@dcode-software
@dcode-software 5 жыл бұрын
My wild guess it's to remove the / in front
@dcode-software
@dcode-software 5 жыл бұрын
If that helped you then check out my video on different kinds of links: kzbin.info/www/bejne/nIvNfJZooLJ-j7c It should clear it up for you
@epickaowca8850
@epickaowca8850 5 жыл бұрын
that can't help because i write code like you in this video so i don't have ''/'' in front :(
@epickaowca8850
@epickaowca8850 5 жыл бұрын
i can fetch data from any file but i can't use post method because of 404 error
@dcode-software
@dcode-software 5 жыл бұрын
404 means not found so you just need to ensure login.php exists and if it does then ensure the path you've given is correct
@tazulislam2698
@tazulislam2698 2 жыл бұрын
Bro, How to pass 2d array? [["",""],["",""]]
@augischadiegils.5109
@augischadiegils.5109 2 жыл бұрын
❤️❤️❤️
@Amigaudio
@Amigaudio 8 ай бұрын
Really? Your name is Dom?
@guruprasadhmathivanan4040
@guruprasadhmathivanan4040 3 жыл бұрын
In postman
@truonghoang7982
@truonghoang7982 4 жыл бұрын
Ok ok 👌
@MrPDTaylor
@MrPDTaylor 5 жыл бұрын
First
@josiahsprankle1146
@josiahsprankle1146 4 жыл бұрын
You moved very quickly, didn't explain much, and were hard to follow.
@augischadiegils.5109
@augischadiegils.5109 2 жыл бұрын
❤️❤️
1.1: fetch() - Working With Data & APIs in JavaScript
15:39
The Coding Train
Рет қаралды 454 М.
Mom had to stand up for the whole family!❤️😍😁
00:39
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 32 МЛН
POST Form Data With JavaScript Fetch API
9:52
ByteGrad
Рет қаралды 27 М.
Using FormData Objects Effectively
13:14
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 37 М.
POST form data using JavaScript's Fetch API
8:01
OpenJavaScript
Рет қаралды 44 М.
GET и POST на JavaScript. Делаем AJAX запросы с помощью XMLHttpRequest | JavaScript 2.0
37:58
WebDev с нуля. Канал Алекса Лущенко
Рет қаралды 16 М.
1.4: JSON - Working with Data and APIs in JavaScript
16:22
The Coding Train
Рет қаралды 645 М.
POST Form Data as JSON with Fetch API in JavaScript
9:25
ByteGrad
Рет қаралды 64 М.
JavaScript Fetch API - One Mistake I ALWAYS MAKE!
4:47
James Q Quick
Рет қаралды 32 М.
Upload Files with Fetch - JavaScript Tutorial
8:35
dcode
Рет қаралды 109 М.