'Attaching different Nodejs API end-points to a button in a simple HTML page?

I am trying to call an API end-point localhost:8000/api/v1/book/confirm on the button in the HTML web page, how can this be done? this will be a post method to the MongoDB database.

so what I want to do is, I already have API tested with Postman which saves the data to the database but how will I call that API endpoint when I click this button and save the data to the database. enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source