Тёмный

Sending JavaScript Http Requests with XMLHttpRequest 

Academind
Подписаться 919 тыс.
Просмотров 213 тыс.
50% 1

Want to send some background (Ajax) Http requests with JavaScript? Learn how to use XMLHttpRequest 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 (this video) - Using XMLHttpRequest: www.academind....
#2 - Using the fetch() API: www.academind....
#3 - Using Axios: academind.com/...
Check out all our other courses: academind.com/...
Starting Code for the series: 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!

Наука

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 166   
@noximus07
@noximus07 2 года назад
wooow... i think you are the only tutorial on youtube... that actually explains what they are doing, and doesn't waste time building out an entire interface. You actually explain what each line is doing, instead of saying just write this! thank you!
@yvhnn
@yvhnn 5 лет назад
I really thank the Universe for your existence! Thank you a lot!
@darwinnoah3329
@darwinnoah3329 3 года назад
i dont mean to be so offtopic but does anybody know of a method to get back into an instagram account? I somehow forgot the account password. I appreciate any help you can offer me
@justinlin9470
@justinlin9470 3 года назад
This is the best video about http request together with promise. You know how to illustrate the concept top-down and step-by-step. Thank you! Such a wonderful job!
@rahulrajtripathi
@rahulrajtripathi 4 года назад
This video proved to be a lifesaver for me. Your Javascript course on Udemy is awesome and there is so much to explore in it. Keep Up the good work Sir.
@selenabostick5844
@selenabostick5844 Год назад
I'm in a front end and backend bootcamp and did the javascript classwork for both. Neither explained sending xml requests this well. Thanks man.
@AJSpeller
@AJSpeller 5 лет назад
Great video. I watch as many of your tutorials as possible from both here and Udemy. I currently on the journey to be a MEAN stack dev and your work has been extremely helpful. Please continue to create great content.
@academind
@academind 5 лет назад
Happy to read that you like my videos Alfred! I'll do my best to keep the videos coming and I wish you all the best on your journey :)
@00el04
@00el04 3 года назад
Awesome, the best video about XMLHttpRequest EVER!! Thanks so much for making videos. I'm learning so much!
@tannerbarcelos6880
@tannerbarcelos6880 4 года назад
legit godly video. I am using ebay find api to make a ecommerce style app and needed this. our axios request went through but CORS did not allow us to work with it. This is great.
@Karan60191
@Karan60191 5 лет назад
After a long time , good tutorials on request, thankyou max
@Anurag_Dhrejen
@Anurag_Dhrejen 4 года назад
i am following you on udemy..you are best teacher i have seen ..its like whenever i want to learn something new, i wish you had created tutorials for that..i get an absolute understanding after watching your videos.
@kprabhanew
@kprabhanew 5 лет назад
Great Max, Can you add a video about CORS options ?
@PhilTang5083
@PhilTang5083 4 года назад
Yes is there one?
@kerryd2060
@kerryd2060 5 лет назад
Max, I'm in most of your Udemy courses !! You're my favorite instructor. Thanks so much for making Udemy videos. I'm learning so much!
@academind
@academind 5 лет назад
I really want to thank you for your awesome support here and on Udemy Kerry!
@unfinishedsentenc9864
@unfinishedsentenc9864 2 года назад
Just what I needed. Thanks a lot Academind. All the broke students thank you :)
@el3atmoney
@el3atmoney 5 лет назад
Native is gold, I'm using angular HttpClient daily, but found this way more enjoyable than just using pre-defined things, Thanks lovely max ^^
@hebert2s
@hebert2s 4 года назад
Awesome, the best video about XMLHttpRequest EVER!! Thanks so much for making videos. I'm learning so much!
@TheNerdyDev
@TheNerdyDev 5 лет назад
Big fan of you, Max. Just started my RU-vid dev channel as well. Thanks a lot for inspiring.
@Karan60191
@Karan60191 5 лет назад
All the best dude
@academind
@academind 5 лет назад
Thank you so much - and good luck for your channel!
@TheNerdyDev
@TheNerdyDev 5 лет назад
@@academind Thanks a lot, Max.
@Wiings18
@Wiings18 5 лет назад
Hey Max, i've been doing your react course in udemy and I seriously can't thank you enough. Love you ❤️
@academind
@academind 5 лет назад
Wow, thanks so much for your support and your awesome feedback Hamouda!
@MewMewCherry1990
@MewMewCherry1990 5 лет назад
Hi, Max. Thanks a lot for your work, you are the best instructor and teacher I have ever met. Greetings from Ukraine!
@academind
@academind 5 лет назад
Thanks so much Katerina, greetings from Germany :)
@DeepakMoses
@DeepakMoses 5 лет назад
Love your content and the way you cover every important aspect that matters. :)
@academind
@academind 5 лет назад
Thank you very much, I'm very happy to hear you're liking it!
@bernab
@bernab 5 лет назад
Thank you Max. By the way, yes, XHR object is the "old way". It seems to me a bit more complicated than Jquery, Angular or the fetch API way of working the communication between front and backend
@andyvoice
@andyvoice 3 года назад
Thank you! It's a pleasure to watch you! Hello from Moscow.
@amielmanzano6396
@amielmanzano6396 3 года назад
This is the video that I have been looking for, Thank you!
@rahulhuilgol5304
@rahulhuilgol5304 5 лет назад
Very thorough! Thank you, Max!
@julianandresgomezgomez7264
@julianandresgomezgomez7264 3 года назад
ERROR: has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'
@kybkap8686
@kybkap8686 Год назад
i started javascript 3 months ago and thnx god they come up with the fetch api this XML is a nightmare to look at
@dhokiarinidh9809
@dhokiarinidh9809 Год назад
Thank you so much, you make learning easier and faster
@0mer870
@0mer870 3 года назад
Amazing, very helpful and simple to understand
@slavon3547
@slavon3547 5 лет назад
Thanks Max! Cool video, as always!
@АлександрНикитин-н6щ
Thanks! It would be cool to look at CORS correct options, abort/canceling requests
@academind
@academind 5 лет назад
Interesting topic, I agree! I'll write that down as a future idea!
@sir_humpy
@sir_humpy 4 года назад
@@academind, please do, Max! Struggling with CORS-related issues myself right now :(
@dimitrisandroid6483
@dimitrisandroid6483 5 лет назад
Thank you Max! Nice explanations and examples, so I understood all the material of the video !
@academind
@academind 5 лет назад
Thanks a lot Dimitris!
@ssbrar7447
@ssbrar7447 4 года назад
Thanks Max, Your contents are very well explained.
@moranmono
@moranmono 5 лет назад
Back to the basics :) Thanks. helped me understand the concept of promises.
@academind
@academind 5 лет назад
Happy to read that Moran, thank you!
@Qors1314
@Qors1314 4 года назад
really great tut man, clear explanations.
@PhilTang5083
@PhilTang5083 4 года назад
I'm glad I found this, thank you, and were you able to do a video about CORS options?
@jacobnotte3699
@jacobnotte3699 3 года назад
Very good instructor! Thank you for sharing your knowledge
@klimax1170
@klimax1170 5 лет назад
Good one! It would be great if you will make more videos about native js
@arishshah1142
@arishshah1142 5 лет назад
Great video Max, could you also throw some light on WebAssembly?
@shashigupta5206
@shashigupta5206 5 лет назад
One more bonus as usual. Thanks
@gdsantos2002
@gdsantos2002 Год назад
Nice explanation, thanks!
@waldemarenns4874
@waldemarenns4874 5 лет назад
Nice one! I started back then with XMLHttpRequests, and made a jump later to the fetch API / jQuery's ajax-API. Old-used thing, those XMLHttpRequests, but they remind me of my beginning in web development. I remember a time, when i loaded whole HTML pages via XMLHttpRequests - something i would never do nowadays. But "ich schweife ab" ... - nice video!
@zealousprogrammer4539
@zealousprogrammer4539 5 лет назад
Thanks Max - did you just gotten married? Your face look fresh and younger haha
@academind
@academind 5 лет назад
Thank you, no marriage though ;)
@TheMessixaviniesta
@TheMessixaviniesta 5 лет назад
The opposite, he got divorced.
@chiffenok
@chiffenok 5 лет назад
@@academind fall in love then ))) just kidding ) but maybe it's true. Hi, from Köln!)
@TraceguyRune
@TraceguyRune 3 года назад
The would mean he got divorced
@va9if
@va9if 2 года назад
That was soo cleann
@rongliao9255
@rongliao9255 5 лет назад
Great subject - very well explained!!
@enssahfayiamomoh8410
@enssahfayiamomoh8410 Год назад
Wonderful...thank you a lot for this lesson...
@justsomeguy8385
@justsomeguy8385 5 лет назад
I'm so glad `fetch()` exists
@FordExplorer-rm6ew
@FordExplorer-rm6ew 4 года назад
But does fetch work in prod? How can I use it whilst avoiding SPA frameworks?
@justsomeguy8385
@justsomeguy8385 4 года назад
​@@FordExplorer-rm6ew fetch is great for simple async requests and it's built into javascript. For production you might be better off using Axios for all of the built in features.
@varleycraig
@varleycraig 4 года назад
Thanks that was extremely helpful.
@sidheshwartiwari9834
@sidheshwartiwari9834 4 года назад
Very informative. Thank you so much
@RuiBarreiras
@RuiBarreiras 4 года назад
Hi, at 5:24.... can anyone explain why xhr.onload comes before xhr.send ()? Thanks
@101appsCoZa
@101appsCoZa 4 года назад
great tutorial. thanks!
@soniablanche5672
@soniablanche5672 Год назад
fun fact: axios uses xhr in browser and http/https modules in nodejs
@rudresh_official
@rudresh_official 4 года назад
Thanks for sharing this video. Yeah I did understood something but after 12 minutes it was difficult to understand .
@ruan1384
@ruan1384 3 года назад
Wow, this is really hard to wrap my head around. This video helps a lot, but Idk man, this stuff is hard
@akki100boyz
@akki100boyz 5 лет назад
Thank you for this video
@zsamotsil
@zsamotsil 5 лет назад
Thanks for Good Work :)
@chadaltenburg249
@chadaltenburg249 4 года назад
And then in reality, you don't always direct access to JSON. At my job the reason for this is that the JSON data is dynamically generated. At which point you will have to manually build the http request header and then use a decompression algorithm to get the JSON data on the response header.
@muchis
@muchis 2 года назад
I don't get why start using recent methods when the whole point of using XMLHttpRequest is to use it in legacy projects where those methods are not available, I think you should've stayed with the traditional way of doing XMLHttpRequest and not introduce promise or async await etc
@MontyKsycki
@MontyKsycki 4 года назад
Thank You for Sharing!!! Very mUch appreciated!! Have a Wonderfull Day!!!! :) Enjoy ~ Peace :)
@rushas
@rushas 4 года назад
in 8:49 you mistyped the 'url' at first, with the 'z' instead of the 'u'. I assume that those two keys are very close to each other in the keyboard you use. What type of keyboard layout do you have?
@ChrisLocke1969
@ChrisLocke1969 5 лет назад
Jquery, 3 lines, done 😉
@academind
@academind 5 лет назад
Not the idea behind the video though ;-)
@hahabanero
@hahabanero 5 лет назад
not worth the shame ;)
@T3Baconsofpower
@T3Baconsofpower 2 года назад
i used the idea to see how can i validate website if its active or not. but because of CORS error i could not. is there way to do that using the Javascript? thanks
@satviknema8629
@satviknema8629 4 года назад
I dont see the point of using promises here? Am i missing something? couldnt we had just returned the response directly? We have the onload method for us. Did you use promises just to make it analogous to using fetch() api?
@nguyentunchannel4438
@nguyentunchannel4438 4 года назад
Nice , thanks
@eduardorivas6959
@eduardorivas6959 6 месяцев назад
GENIAL! thanks you.
@w3cprogramming678
@w3cprogramming678 3 года назад
really thanks
@jaimeeduardo159
@jaimeeduardo159 4 года назад
Great video
@alvinluk9724
@alvinluk9724 3 года назад
hope subtitles for future
@kawsarbinsiraj1816
@kawsarbinsiraj1816 5 лет назад
just WOW & awesome !!
@academind
@academind 5 лет назад
Thank you so much :)
@SandeepKumar-cx7cz
@SandeepKumar-cx7cz 4 года назад
9:11 promise example
@ghury1
@ghury1 11 месяцев назад
how to create an javascript interceptor, that intercept every xmlHttpRequest, and show an alert each time the xmlHttpRequest goes in error or errorCode is != 200?
@gkarapeev
@gkarapeev 4 года назад
Awesome!
@umutturan9282
@umutturan9282 4 года назад
Great! Thank you :-)
@yannik8271
@yannik8271 2 года назад
Vielen Dank!:)
@FordExplorer-rm6ew
@FordExplorer-rm6ew 4 года назад
Now that I've been building and deploying applications for some time now... My question really isn't so much about Ajax , libraries , or the xhr object itself, but... More so, *How do these things work in prod?* How can I avoid those icky CORS errors? What is best practice for stuff like that? I see all of these tutorials , and it's like, yeah... that's nice for my local machine... But I'm concerned about prod and others. The duct tape and glue way to avoid it seems to be, to make hybrid php/JS applications on apache and express (2 servers) Or figure out how to connect websockets (to work in prod mind you) Idk, kinda wanna avoid the whole hybrid php/js thing. Or is that just something one has to go through? Surely there are better ways? Idk.
@ProgrammingwithPeter
@ProgrammingwithPeter 5 лет назад
Good showcase as always, I prefer simplicity so axios is a winner for me, of course not for prototypes.
@RahulKumar-rk1tf
@RahulKumar-rk1tf 5 лет назад
Thank you, I am following you very long time and I learnt a lot from your video but my one concept is never clear about promises and async and await. I would like to ask could you please comment here function getData using async, await this will clear my doubt. Thanks you!!!
@Vofr
@Vofr 3 года назад
Very helpful and easy to understand :)
@sebastiannietor9724
@sebastiannietor9724 3 года назад
I got this message: "WSDoAllReceiver: Request does not contain required Security header" :( What can i do?
@zoel8203
@zoel8203 4 года назад
I'm not to sure how to make a javascript fetch URL where you paste it in the bar on a browser then it sends back the cookies Please help me!
@olivestechnologies9040
@olivestechnologies9040 3 года назад
im applying for a payment integration on my website and the merchant gave me files to send xml request but im totally confused any helP>>>> ?????????????????????????????
@emsdy6741
@emsdy6741 4 года назад
I am having problem when I implement POST method error 404 (Not Found). But it works perfectly on GET method. Please help.
@sir_humpy
@sir_humpy 4 года назад
I'm lost - when I add xhr.setRequestHeader('Content-Type', 'application/json'); I get a "Access to XMLHttpRequest at 'api.......' from origin 'localhost:4200' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'localhost:4200, *', but only one is allowed." When I delete the xhr.setRequestHeader bit, I get this error message: "Content type 'text/plain;charset=UTF-8' not supported". So I have to go back to set the headers to read json, right? It's a catch 22!!!!!!
@miguelcunha1914
@miguelcunha1914 3 года назад
The google API doesn’t recognise the XMLHttpRequest function Is this normal? What should I do
@AnujKumar-ld6kq
@AnujKumar-ld6kq 3 года назад
Hello I am very new to JavaScript and API Automation. My project uses POST APIs with XML request (with input value tags and userid and password) and XML response. and using JEST framework. Can you please help me building a simple test with handling XML request response, Headers, URL, authorization key ?
@nguyentunchannel4438
@nguyentunchannel4438 4 года назад
Can you make video about extension chrome
@sunindragupta9236
@sunindragupta9236 4 года назад
Hi, I am getting access-control-allow-origin error when using the Tesla API, xmlHttpRequest via javascript, do you have any advice
@yana7j
@yana7j 3 года назад
It's sad that there is no eng sub
@humuhumunuku2113
@humuhumunuku2113 3 года назад
i feel u
@adityarajora7219
@adityarajora7219 3 года назад
can anybody make me understand the sequence of execution of that code???????
@maximo7850
@maximo7850 5 лет назад
I want one of that mug 😆
@academind
@academind 5 лет назад
Sorry, not for sale :/
@maximo7850
@maximo7850 5 лет назад
@@academind :/
@fishnetweaver7747
@fishnetweaver7747 4 года назад
Max, please include subtitles for this video, thank you...
@mustafaal-maawi2343
@mustafaal-maawi2343 4 года назад
Is it possible to send an SSL request via axion or xml or fetch or how can I make my nodesjs app does the request in the browser
@pjmclenon
@pjmclenon 4 года назад
hello my API keeps retruning HTML and so i cant run my search box to call the API do you know how to solve this issue? in your code i get null and so i have to comment out responseType line and then i just get HTML code in the console this is a sample API call gigablast.com/search?format=json&q=Lisa thxz for any help i been trying to solve this myself and online for 3 weeks Lisa does anyone know the fix for this? i followed the code for fetch from david ceccia but i still get only HTML and so i will also get cant parse error < because thats the 1st caracter of an HTML page
@TheBBastard
@TheBBastard 5 лет назад
Thanks Max! You out this topic in pieces. Very clear
@academind
@academind 5 лет назад
Thank you so much!
@cruquen
@cruquen 2 года назад
i am blocked by CORS Policy while trying to getData :(
@ivanmikodanic4006
@ivanmikodanic4006 4 месяца назад
Github Copilot autocompleted url to this video xD
@mooodddy1
@mooodddy1 5 лет назад
Plz, max more explain http2 and how to use it?
@PollittBart-e2r
@PollittBart-e2r 3 дня назад
Howell Manors
@novelstudio1651
@novelstudio1651 3 года назад
how to get json using param (id) ?
@yourytking
@yourytking Год назад
How do you get around hard coding the url?
@uzairwani7543
@uzairwani7543 2 года назад
stuck with the CORS issue.. please help
@RainOnline
@RainOnline 4 года назад
What font are you using?
Далее
JSON and AJAX Tutorial: With Real Examples
40:45
Просмотров 1,8 млн
КОГДА НАКРОШИЛ НА ПОЛ #shorts
00:19
Просмотров 855 тыс.
Лиса🦊 УЖЕ НА ВСЕХ ПЛОЩАДКАХ!
00:24
Sending JavaScript Http Requests with Axios
11:50
Просмотров 174 тыс.
Async JavaScript Part 1: What is AJAX?
21:25
Просмотров 120 тыс.
HTTP Crash Course & Exploration
38:30
Просмотров 1,1 млн
AJAX and XMLHttpRequest Object
28:17
Просмотров 6 тыс.
AJAX Crash Course (Vanilla JavaScript)
1:09:43
Просмотров 724 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,2 млн
Learn XML HTTP Requests in JavaScript | AJAX Tutorial
10:09
JavaScript Pro Tips - Code This, NOT That
12:37
Просмотров 2,5 млн
5 JavaScript Concepts You HAVE TO KNOW
9:38
Просмотров 1,4 млн
Распаковка Huawei Mate XT🔥
0:54
Просмотров 96 тыс.
Внутри коробки iPhone 3G 📱
0:36
Просмотров 237 тыс.
Wireless switch part 177
0:58
Просмотров 3,5 млн