Why does res.json refresh the page information instead of returning json data on the page?

problem description

use mongoose to manipulate data in MongoDB Atlas

when adding data, if I use res.json (data) to try to refresh the data on the page, only one data in json format will be displayed on the page

but when I delete the data, if I do this, it will refresh the data on the page, that is, to achieve the effect I want

but when I was watching the video of Big Rails365, he also used res.json (data) to add data, and succeeded

.

want to know why this is QAQ

attached node teaching video link: ideo/av20196752/?p=17" rel=" nofollow noreferrer "> node-TodoList

related codes

/ / Please paste the code text below (do not replace the code with pictures)

app.post("/todo", function (req, res) {
    Todo(req.body).save(function (err, data) {
        if (err) {
            throw err;
        }
        console.log(data);
        res.json(data);
    });
});

app.delete("/todo/:item", function (req, res) {
    // data = data.filter(function (todo) {
    //     return todo.item.replace(/ /g, "-") !== req.params.item;
    // });

    Todo.find({
        item: req.params.item.replace(/-/g, " ")
    }).remove(function (err, data) {
        if (err) {
            throw err;
        }
        console.log(data);
        res.json(data);
    })
});

post returns the result

clipboard.png

delete returns normal results, which means that the items to be deleted in the list are missing

I also hope the passing bosses will give us some advice. Thank you very much

.
Jul.06,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7bad92-2a064.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7bad92-2a064.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?