You have all required information into Javascript, right?
1. You should create one jsp which opens Mysql connection to DB, takes the information form the HTTP request and saves the information.
2. From
JS you crate GET/POST request to the jsp from point 1 with information in HTTP request