For example, I have a registration form and I also have a button for submitting the details, so once I click the button, I want them to be sent to the mysql database. Unfortunately, I only know how to do db queries on the server.js but how do I do it on any script? Below is the way that won't work
$("button#submit").click(function () {
var username = $('#usr').val();
var password = $('#pwd').val();
db.query("INSERT OR REPLACE INTO user_data (username, password) VALUES (" + username + "," + password + ")");
//// something like this
})
