I need to insert data to database by pressing button in html file
<body>
<button type="button" class="buttonEql" id="btnEql">=</button>
<script>
const btnEql = document.getElementById('btnEql')
</script>
</body>```
Script with connection (external file named: "script.js"):
const mariadb = require("mariadb/callback");
var con = mariadb.createConnection({
host: "localhost",
user: "root",
password: "",
database: "database"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "INSERT INTO history (count, user) VALUES ('test', 'test')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted"); });
});```