A
A
Andrey Trunin2017-07-24 18:26:30
JavaScript
Andrey Trunin, 2017-07-24 18:26:30

Is it possible to open JSON file via JS without AJAX?

I am making my own js library.
There are files:
Neon-library.js//library file
Neon-configuration.json//configuration
It is necessary to make the library file open the configuration file and read it to configure the library. Write if this is possible and if so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kornilov, 2017-07-24
@LamerX

It can be ported to the browser with the usual http.
There is a good script tag for this, since the json object is essentially a JS object. Therefore, in the file itself, you need to assign the json object to a global variable.
File:
Browser Porting: Usage:

<script>
if(fileJSON) console.log(fileJSON);
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question