How to call JSON info? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to call JSON info?

I'm trying to call some information in a json object in a separate file. Can y'all give me the correct syntax to do so?

29th Dec 2018, 3:04 AM
Josh Ewing
Josh Ewing - avatar
7 Answers
+ 2
However you could use ajax to retrieve the data.
29th Dec 2018, 4:54 AM
Calviղ
Calviղ - avatar
+ 2
I built a sample code on reli.it, please check out this code, to demo Ajax fetch function retrieves a local data json file. https://repl.it/@cv1r2d3/ajex-fetch-local-json-file https://code.sololearn.com/WrSnBsjfFCqp/?ref=app
29th Dec 2018, 5:04 AM
Calviղ
Calviղ - avatar
+ 1
Local JavaScript cannot load any local file contents.
29th Dec 2018, 4:02 AM
Calviղ
Calviղ - avatar
+ 1
Due to security reasons, JavaScript codes which could be sent from external web servers, are not allow to read or write local resources in order to protect the local system.
29th Dec 2018, 4:34 AM
Calviղ
Calviղ - avatar
0
Could you reiterate
29th Dec 2018, 4:03 AM
Josh Ewing
Josh Ewing - avatar
0
Oh okay
29th Dec 2018, 4:47 AM
Josh Ewing
Josh Ewing - avatar
0
I'll try
29th Dec 2018, 4:55 AM
Josh Ewing
Josh Ewing - avatar