M
M
maxemga2021-04-05 23:05:41
Express.js
maxemga, 2021-04-05 23:05:41

Action in form Html doesn't work, what should I do?

I need to contact the server on a certain path by pressing a button, it is necessary through Action, but for some reason it does not work, requests do not go away ( I tried http://localhost:80/api/server/profile )

<form action="/profile" method="post" enctype="multipart/form-data">
    <div class="mb-3">
        <label for="formFile" class="form-label">Фото товара</label>
        <input class="form-control adminInputPhoto" type="file" id="formFile" name="img">
    </div>
    <div class="mb-3">
        <button type="submit" class="btn btn-primary mt-3 adminButton">Отправить</button>
    </div>
  </form>

Server script
router.post('/profile', (req, res) => {
    res.json({mee: 'gsgsg'})
    console.log("gsg")
})

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question