K
K
keslo2014-08-19 09:12:41
PHP
keslo, 2014-08-19 09:12:41

How to delete an entry in JSON using an AJAX request on the server?

Good afternoon, ladies and gentlemen!
The cases are as follows:
- there is a file on the server in JSON format
- there is a JS + AJAX script that displays data in the form of table rows on the page
- each row is planned to have a button, when clicked on which the row is deleted from JSON on the server

How can this be implemented ?

I am newbie. But I realized that this cannot be done in pure JS, but a server-side language is needed. It turns out you need to link PHP + JS + AJAX.

I would be grateful for a code example.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
_
_ _, 2014-08-19
@AMar4enko

Have you tried googling? Well, I do, just in case.

A
Alexander Kubintsev, 2014-08-19
@akubintsev

Yes, without the server side in any way, but you can choose node.js so as not to learn php

A
Alexey Lebedev, 2014-08-19
@swanrnd

It is correct to store in a DB, instead of in a file. You will spend more time parsing a file than studying a database.
In general, what you need to study:
1) sending a request to the server via JS
2) parsing JSON and outputting to a table in the client
3) processing POST and GET requests on the server
4) fetching and deleting from the database
5) outputting data from php via echo.
This is the easiest option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question