How to fetch data stored in a json file | Read with javascript local json file.

Поделиться
HTML-код
  • Опубликовано: 29 авг 2024
  • Hello everyone, in this video we are going to see how to read a JSON file with JavaScript.
    To be precise we are going to fetch records of products stored in the JSON file, and display them in the page using an html template from the JavaScript file.
    You can find the source code on my website :
    digitalfox-tut...
    If you feel like saying thanks, you can buy me a coffee.
    www.buymeacoff...
    Photos by
    Pixel Bee on
    unsplash.com/@...
    Fabian Heimann
    unsplash.com/@...
    John Torcasio on
    unsplash.com/@...
    Salman Hossain Saif on
    unsplash.com/@...
    Darryl Low on
    unsplash.com/@...
    Simon Daoudi on
    unsplas

Комментарии • 84

  • @saif71
    @saif71 11 месяцев назад +1

    I’m happy to see that you used my photo in your video. Thank you for acknowledging my contribution and giving me credit.

  • @christopherpink842
    @christopherpink842 2 года назад +4

    THANKS AGAIN!!! this what i have been looking for, a simple tutorial to fetch data and converting to javascript object then display

  • @DigitalFox-tutorials
    @DigitalFox-tutorials  3 года назад +4

    I made an error in 4:12, the value of the alt attribute is ${image.description}, sorry guys.

  • @melfire7677
    @melfire7677 2 года назад +3

    Simple et efficace. Merci.🔥🔥🔥

  • @thefivekingdoms
    @thefivekingdoms 3 месяца назад

    Thank you so much! Can you make other videos like this? Like fetching json files for other things. Thank you and God bless.

  • @xaminexgamer267
    @xaminexgamer267 2 года назад

    thanks I've been looking for this all day

  • @Koala_Studio14
    @Koala_Studio14 6 месяцев назад

    Thank you so much!! you help me a lot.

  • @yousofsayed6649
    @yousofsayed6649 2 года назад

    Thanks bro, it's really great work ♥️♥️

  • @svrthardware9038
    @svrthardware9038 Месяц назад

    How to make dynamic product details page using same ajax script
    If user touches on the list it must open dynamic product detail page

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Месяц назад

      Hey, check this out i think it's what you need.
      digitalfox-tutorials.com/tutorial.php?title=Creating-dynamic-web-pages-using-PHP-and-MySQL

  • @wowvhee5999
    @wowvhee5999 5 месяцев назад +1

    shouldnt the send() come after the onload?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  5 месяцев назад

      A few years ago we used to put the send() method after the onload ev. listener due to a browser bug. But this days it works fine either way. Also we don't use so much the XMLHttpRequest method. We switched to the fetch API.

    • @wowvhee5999
      @wowvhee5999 5 месяцев назад

      yh, i want to learn the fetch api method but im contemplating if it can fetch local json file? coz ive known it to only fetch api from remote servers@@DigitalFox-tutorials

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  5 месяцев назад +1

      You can fetch a local JSON file using the fech API. But you can only read the data, you can not alter a file using JavaScript.

  • @desuno2609
    @desuno2609 2 месяца назад

    So for me this doesn't work, CORS actively blocks the request. How do I circumvent this?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Месяц назад

      Hey, sorry for the late response. I think that in a local environment the problem occurs when we
      use visual studio's live server.
      I am not 100% sure, but i read that somewhere.
      Set up a localhost server like MAMP or XAMPP to try it out.

    • @desuno2609
      @desuno2609 Месяц назад

      @@DigitalFox-tutorials no problem, thanks for replying! it was indeed a problem with visual studio live server. i got it fixed eventually 👍

  • @franconiangaming5232
    @franconiangaming5232 Год назад

    MY GOAT

  • @rongaming.8961
    @rongaming.8961 Год назад

    Thanks Bro

  • @edmunsanchez
    @edmunsanchez 2 года назад +2

    Hi, do you by any chance know how to include a “load more” button/feature to be able to show more products?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      Hey, good idea, i will make a video about it

    • @sophiawokoma3711
      @sophiawokoma3711 2 года назад +1

      Hiya have you figured out how to do this by any chance ?

    • @sophiawokoma3711
      @sophiawokoma3711 2 года назад +1

      @@DigitalFox-tutorials Thank you so much !!! will look at this now and get back to you

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад +1

      Check this out, and download the source code
      digitalfox-tutorials.com/tutorial.php?title=Creating-a-load-more-button-with-fade-in-effect-in-javascript

    • @sophiawokoma3711
      @sophiawokoma3711 2 года назад

      @@DigitalFox-tutorials this is amazing !! I actually figured how to work it out using the previous file you posted however I definitely will be going through the article so I actually understand a bit more what’s actually happening 😂😂😂 THANK YOU !!!!

  • @yomnayoyo-yl4nu
    @yomnayoyo-yl4nu 3 месяца назад

    Hi thank u but i need the code i cant found it in youre website

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  3 месяца назад

      Hey, i updated the link in the description . I didn't notice that it was broken. Sorry.

  • @christopherpink842
    @christopherpink842 2 года назад

    can you please do a video of simple CRUD and how to empty out the data in an input field after submit Thanks

  • @mr.venexyt9518
    @mr.venexyt9518 5 месяцев назад

    bro source code doesn't found for your link plz provide source code

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  5 месяцев назад

      Get the source code from my website
      digitalfox-tutorials.com/tutorial.php?title=Fetch-data-stored-in-a-json-file-with-JavaScript

  • @athraafaraj8387
    @athraafaraj8387 2 года назад

    thanks for this video, if I have a database locally, how can I fetch them? and if I have DB on online server, how can I fetch data on-page and connect the web with the data too

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      Thanks for you comment, check out this video ruclips.net/video/qttOpYzsIPs/видео.html

  • @cuteworld7489
    @cuteworld7489 2 года назад +1

    can mysql data in jason?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      Yes, watch this video ruclips.net/video/qttOpYzsIPs/видео.html

  • @TG_2
    @TG_2 2 месяца назад

    It says its not iterable

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 месяца назад

      I think there is maybe a typo in your code.
      Get the source code from my website and compare it to yours.
      digitalfox-tutorials.com/tutorial.php?title=Fetch-data-stored-in-a-json-file-with-JavaScript

  • @sukhomoyb
    @sukhomoyb 2 года назад

    Excel Bro,
    Realy a great help in my struggle on the same... Is there any way I can get this download source code for my learning reference?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      Thank you, here you go : digitalfox-tutorials.com/youtube-files/storing-data-in-json-file.zip

  • @ranjanik7603
    @ranjanik7603 2 года назад

    Thank you so much ! It helped me a lot :)

  • @lyricalbuddy246
    @lyricalbuddy246 2 года назад

    Dude... I am getting cross origin not allowed error... Plz help me as soon as posible... I am having a project to submit....

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      Hey, are you trying to fetch data from a remote address, or localy? If you use a live server from VS code maybe that is the problem. Run the files in you localhost 8080 port.

    • @lyricalbuddy246
      @lyricalbuddy246 2 года назад

      @@DigitalFox-tutorials so for this I'll be needing xampp application??

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      @@lyricalbuddy246 Yes, installation is very straight forward, don't worry.

    • @lyricalbuddy246
      @lyricalbuddy246 2 года назад

      @@DigitalFox-tutorials ok thank you so much....

  • @OTFBYFK
    @OTFBYFK Год назад

    Hi I am looking for a like and dislike button tht increments on button click but the data is supposed to be save in local file instead of db or using local storage

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад

      Hey check tihs out ruclips.net/video/_gToDN-aoyI/видео.html , maybe it will give you an idea on how to do it.

    • @OTFBYFK
      @OTFBYFK Год назад

      @@DigitalFox-tutorials ....I don't want a browser local storage I want to handle thru a text file.i want to store the count in file and the increment it the number of time the user like it and display in a label.can u please send me a sample code

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад +1

      I will try

    • @OTFBYFK
      @OTFBYFK Год назад

      @@DigitalFox-tutorials ..can u please do it today its urgent.i just want two buttons like and dislike and those like and dislike count is saved in a text file and shown on the screen in the form of labels

    • @OTFBYFK
      @OTFBYFK Год назад

      @Digital Fox Make it very simple only two buttons wid no css and it increments the value based on the last counter value from the file..I just need to see the functionality thts it .ur quick response will be highly appreciated 👍

  • @nareshbatta7915
    @nareshbatta7915 Год назад

    It's showing undefined

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад

      Hey, click on the link to download the source code, maybe you have a typo in your code.
      digitalfox-tutorials.com/tutorial.php?title=Fetch-data-stored-in-a-json-file-with-JavaScript

  • @karl-erik4875
    @karl-erik4875 Год назад

    Source code link doesnt work

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад +1

      Try this : digitalfox-tutorials.com/tutorial.php?title=Fetch-data-stored-in-a-json-file-with-JavaScript

  • @abayomidove5434
    @abayomidove5434 2 года назад

    thnaks so much but the link is not working

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      Try this out digitalfox-tutorials.com/tutorial.php?title=How-to-fetch-data-stored-in-a-json-file-with-JavaScript

    • @abayomidove5434
      @abayomidove5434 2 года назад

      @@DigitalFox-tutorials its still not working , I'm from Nigeria

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад

      @@abayomidove5434 Hey, it works i just tested it out, this is a link to the article on my website, you will find the download button at the end of the article.

  • @panjects
    @panjects Год назад

    xmlhttprequest in 2022, rly?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад

      Hey, coding for many years creates habits, sometimes i use fetch, sometimes xml-http-request. If you like to see how this is done using fetch, check this out: ruclips.net/video/eS-FVnhjvEQ/видео.html.

  • @ahmedjemal5859
    @ahmedjemal5859 2 года назад

    can you send the source code please?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  2 года назад +1

      Here you go: digitalfox-tutorials.com/youtube-files/products-from-json-file.zip

  • @kawtarmorag4131
    @kawtarmorag4131 Год назад

    So fast no explaination nothing this is not for beginers so this vidéo is not for me i dislike

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад

      I am sorry that this video was not helpful to you, but still you can download the source code and use it. digitalfox-tutorials.com/tutorial.php?title=Fetch-data-stored-in-a-json-file-with-JavaScript

    • @kawtarmorag4131
      @kawtarmorag4131 Год назад

      @@DigitalFox-tutorials can i contact u?

    • @DigitalFox-tutorials
      @DigitalFox-tutorials  Год назад

      @@kawtarmorag4131 Yes, here is my facebook page
      facebook.com/digitalfox.web.tutorials