L
L
loginovdima2017-08-17 11:08:11
JavaScript
loginovdima, 2017-08-17 11:08:11

Why do I get "404 *.json not found" when I try to write information to json?

Good afternoon!

There is an AJAX request:

$.ajax({
            type: "POST",
            url: "/jsons/accounts.json",
            data: params,
            dataType: "text"
        });

params - a variable where I store the information necessary for recording (the information is first written to localstorage, then to the *.json file).
When you click on the button that calls this AJAX request (deleting a row from the table), the deletion does not occur, the console displays:
41dd64463c194ef6ba8b8dc185f23953.png
The json itself lies in the project along the path /public/jsons/accounts.json.
Other files along the path, such as /public/images/file.png, are visible.
What am I doing wrong?

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Exploding, 2017-08-17
@Exploding

Ufff... That's all))
The url parameter specifies the data handler for post. You need to transfer the script to the php, and there the data that has already arrived is shoved into a file.
And the way. Obviously a 404 error.

A
Alexander Wolf, 2017-08-17
@mannaro

I suspect there is simply no route (/jsons/accounts.json).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question