Nodejs / Express Ajax POST调用

I am trying to make an Ajax call from javascript function in nodejs/express application. The function code is below:

function Save_User_Changes(user_id) {
    alert('saving changes')
    let data = {}
    data.first_name = document.getElementById('first_name').value;
    data.last_name = document.getElementById('last_name').value;
    data.nickname = document.getElementById('nickname').value;
    data.email = document.getElementById('email').value;
        $.ajax({
            type: 'POST',
            data: JSON.stringify(data),
            contentType: 'application/json',
            url: '/users/save_user',
            success: function (data) {
                console.log('success');
                console.log(JSON.stringify(data));
            }
        });
}

And this is my routes file:

router.post('/save_user', (req, res) => {
// let obj = {};
console.log('body: ' + JSON.stringify(req.body));
return res.send(req.body);
}

I do get success message with data printed as expected. However, nothing is happening on the with the route /users/save_users. Thanks in advance for any guidance.

You never answer to your POST call server side.

You could do as the following :

router.post('/save_user', (req, res) => {
   console.log('body: ' + JSON.stringify(req.body));
   // Here could go the processing to save your user ...
   return res.sendStatus(201);
}