Well, you have to send an AJAX request to server and that request will be post request and it contains the form data which you want to save in the database.
On the serverside, let’s say you are using PHP Laravel Framework then you will have to extract the data from the request and save that data into the database using either ORM or write the insert query or whatever your preferred method.
To submit post request from Javascript code, AJAX request is your only option.