How to call JSON info? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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