A
A
Arseniy Sokolovsky2021-04-18 16:30:33
JavaScript
Arseniy Sokolovsky, 2021-04-18 16:30:33

How to create JSON file in project directory using JS?

There is an html file and the position of the phone is tracked there (x, y, z) and there is a JSON file that looks like this:

{
    "x":"",
    "y":"",
    "z":""
}

So, with the help of js, you need to write x, y and z variables in json in real time.
That is, there are variables x, y and z and you need to constantly write them to the json file in real time.
I tried different scripts from the Internet, but a file is created everywhere, then text is written to it, but this file needs to be downloaded, but I need it to be created in the directory.

Maybe someone knows how to do it (*Without Node JS*)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yupiter7575, 2021-04-18
@yupiter7575

So you want to create a file on the server using the language for the browser? For such masochists they came up with a whole software - node js

R
Rsa97, 2021-04-18
@Rsa97

No way. Do you want every site to be able to write any file to your computer?

V
Vladimir, 2021-04-18
@djQuery

Alas, JS does not have access to the file system.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question