Sending JSON with AJAX/XMLHttpRequest - JavaScript Tutorial

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

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

  • @dcode-software
    @dcode-software  6 ปีที่แล้ว +4

    If you're unfamiliar with AJAX/XMLHttpRequest, check out my video on the topic:
    th-cam.com/video/rjmtYkRK1nM/w-d-xo.html

    • @SVTechno
      @SVTechno 4 ปีที่แล้ว

      i want to display the name got in responses in my main html page using innerHtml or something else.
      So how can i access the string and display it

    • @calebcadainoo
      @calebcadainoo 4 ปีที่แล้ว

      How do I submit image and text together in one submission/submit as a stream to an API without getting CORS error

  • @TheMisieq93
    @TheMisieq93 5 ปีที่แล้ว +6

    It is amazing how one single line of code can change EVERYTHING... Thank you for your short, but meaningful tutorial!

  • @yannik8271
    @yannik8271 2 ปีที่แล้ว

    I was looking many days for a video like this (how I can access JSON Data with PHP sent from vanilla Javascript) and finally found it. You never fail to impress bro.

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

    Thank you, very simple, fast and clear

  • @yannik8271
    @yannik8271 2 ปีที่แล้ว

    You're my favorite coding TH-camr. Enjoy every video from you mate!:)

    • @dcode-software
      @dcode-software  2 ปีที่แล้ว +1

      Awesome, thank you! Happy to help

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

    Thanks. Very helpful in December 2022. I've subscribed.

  • @DkGaming86
    @DkGaming86 3 ปีที่แล้ว

    i like your video because you're not indian guy, and you are very good, ty bro

  • @MarbustVideosEntertainment
    @MarbustVideosEntertainment 3 ปีที่แล้ว

    Bro you're a hero without a cape, thanks, the best it's 100% javascript, I hate jquery, you save my life

    • @dcode-software
      @dcode-software  3 ปีที่แล้ว

      Absolutely no problem. I suggest you take a look at the Fetch API though.

  • @zihenPL
    @zihenPL 2 ปีที่แล้ว

    Great video!

  • @bbbear1326
    @bbbear1326 2 ปีที่แล้ว

    thank you , it's so good

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

    god bless you mate. you save my days

  • @khalilal-nsser6576
    @khalilal-nsser6576 3 ปีที่แล้ว

    you are the BEST !!! Thanks man

  • @ahmedamr3690
    @ahmedamr3690 2 ปีที่แล้ว

    Thanks for the tutorial, I get a json syntax error. How can I validate the requestPayload?

  • @jarnopunt
    @jarnopunt 3 ปีที่แล้ว

    thank you! helped me out!

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

    Thanks a really short and direct tutorial for this matter.
    I would love to know which extensions you use in your vs code too. maybe you can do a small video about it. keep it up !

    • @dcode-software
      @dcode-software  5 ปีที่แล้ว +1

      Hey thanks! A few people have asked about my extensions, I'll keep it in mind

  • @giancarloandrebravoabanto7091
    @giancarloandrebravoabanto7091 3 ปีที่แล้ว

    he is better than stackoverflow, hell

  • @abhishekjaiswal6492
    @abhishekjaiswal6492 3 ปีที่แล้ว

    When I am using. window.location.replace command to replace current page with another one then the json data is not sending to server, can you tell me why is it happening so please....?

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

    This helped me so much, thank you! How would you pass two/multiple arrays to the php file using this method?

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

    So how to you apply this for a practical form, like an email subscription form?

  • @ARTICFR0ST
    @ARTICFR0ST 3 ปีที่แล้ว

    Can you explain the url for POST? I'm having a hard time understanding where people get these mock up url links and where I can get one too, or if I can use a .js or .txt file?

  • @ahmedabdulrazzaq2015
    @ahmedabdulrazzaq2015 3 ปีที่แล้ว

    Thank you!

  • @a.chithrai1921
    @a.chithrai1921 3 ปีที่แล้ว

    how to avoid HTTP Error 414. The request URL is too long while using AJAX/XMLHttpRequest

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

    great job as always! :)

  • @graciela8742
    @graciela8742 2 ปีที่แล้ว

    thanks, God bless you

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

    Thank you comrade!!

  • @mnchabel8402
    @mnchabel8402 5 ปีที่แล้ว

    thank u for this great video.

  • @rickyu1978
    @rickyu1978 4 ปีที่แล้ว

    if http sends data in bits and pcs (stream/buffer) how does php server parse the body without 'parsing it' .. In node i think you cant simply log the request which will show the body like that. why the difference. thanks.

  • @riansefriadisefriadi3407
    @riansefriadisefriadi3407 4 ปีที่แล้ว

    thank you very much for the tutorial, I like this 😁😁

  • @Zuxaw
    @Zuxaw 3 ปีที่แล้ว

    I love you thank you

  • @lesterllorca4837
    @lesterllorca4837 4 ปีที่แล้ว

    Hello there dcode, how can I redirect to the recieve.php page after posting the json object? I'm stuck

  • @BLOPIsUrM8
    @BLOPIsUrM8 4 ปีที่แล้ว

    I want to implement this is django. But it asks for csrf token. Please help.

  • @andrzejserafin2758
    @andrzejserafin2758 3 ปีที่แล้ว

    Hey, what if the server side was running on Java instead of php and I'd like to send a json file to the server, can I use the same method?

    • @dcode-software
      @dcode-software  3 ปีที่แล้ว

      Yep, it will still work. This method is all about the client-side, it doesn't matter which server side tech you're using

  • @andresbelendez6008
    @andresbelendez6008 5 ปีที่แล้ว

    Question!, I had this set up via a POST Method on the html and on the php I only had to place $_POST; Why it doesn't work on the same way with this method?

  • @yxngblader4848
    @yxngblader4848 5 ปีที่แล้ว

    Can you help me please? I need only to POST to a server. And I write localhost:5000 and I get error:bad request. IDK what to do. HELP pls!!!!

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

    thank you

  • @ShadowFaxNG
    @ShadowFaxNG 4 ปีที่แล้ว

    Hey @dcode How can I convert the sent data(user input) to an actual json file so that it can be loaded into a table using ajax. You only seemed to convert it to php here.

  • @jaehyeonroberthan763
    @jaehyeonroberthan763 4 ปีที่แล้ว

    Hi, when I follow your steps, I got an error in the line 'xhr.send(jsonString)'. The error shows 405 (Method Not Allowed). What is the problem?

    • @dcode-software
      @dcode-software  4 ปีที่แล้ว

      Are you using a built-in web server as part of your text editor? Either way, I recommend using a server like Apache/NGINX which will support all request methods

  • @pricklypickles
    @pricklypickles 4 ปีที่แล้ว

    Hi Dom, sorry to bother, I've been watching some of your video tutorials now. As an amateur script writer(still learning), when in the real world would I need to use or run this particular video tutorial? Thanks.

  • @adnantariq3346
    @adnantariq3346 5 ปีที่แล้ว

    Hi, firstly thank you for the explanation. I have a Newb question, I'm getting the following error "405 (Method Not Allowed)" . I got this approach with your other example as well. what am i missing or doing wrong here?
    thx

    • @dcode-software
      @dcode-software  5 ปีที่แล้ว

      That's a "problem" with your server - try a different server or make sure that your "GET" or "POST" is spelt correctly.

  • @andrewericson781
    @andrewericson781 3 ปีที่แล้ว

    anyone know the vs code theme he is using?

  • @IncredibleGilgitBaltistan
    @IncredibleGilgitBaltistan 4 ปีที่แล้ว

    I want a help , can you reply

  • @renanalves5687
    @renanalves5687 5 ปีที่แล้ว

    Notations: 2:44

  • @lehlohonololefatle6300
    @lehlohonololefatle6300 4 ปีที่แล้ว

    Why use PHP but the description is JavaScript tutorial

    • @dcode-software
      @dcode-software  4 ปีที่แล้ว +1

      This video is about sending JSON data through a JavaScript AJAX request. The server side technology happens to PHP

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

    Great tutorial, but you've got me lost in PHP T_T

    • @dcode-software
      @dcode-software  6 ปีที่แล้ว

      Thanks and yeah look PHP is probably the most well known back end language so that's why I went with it :/

    • @adampielach4942
      @adampielach4942 6 ปีที่แล้ว

      @@dcode-software It's not your fault. It's just me that doesn't want to learn everything. I used to learn PHP when I was 15 (now, 29) and I didn't quite like it as it got me a little confused at that time. However, I am more inclined to learn JS and all that "front" languages, that's more for me to be honest. I'm also not closing the doors to PHP, but I prefer to master languages mentioned above to feel more fomfortable :)
      Anyway, great work!

  • @fahadhafeez8086
    @fahadhafeez8086 4 ปีที่แล้ว

    Your keyboard disturb a lot!

  • @M.Darsky
    @M.Darsky ปีที่แล้ว

    it's not ajax. dis,

  • @CinqueTsunami
    @CinqueTsunami 4 ปีที่แล้ว

    i can't stand the sound of the fucking keyboard

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

    thank you