I'm new to Wix. I'm getting this error when I try to console.log data in an html frame. The data is coming from a backend Web Module.
Here is the function on the front end
export function button1_mouseIn(event) { get_info(function(result){ console.log(result); }); }
and this is the code on the backend. Note that this code works when I run locally on just Node.js but when I try to run on Wix environment I get the error.
export function get_info(callback) {
var mysql = require('mysql');
var connection = mysql.createConnection({
host: 'xxxx',
user: 'bob',
password: 'xxxxxxx',
database: 'xxxxx
});
connection.connect(function (err) {
if (err) throw err;
connection.query("SELECT Name FROM webform", function (err, result) {
if (err) throw err;
return callback(result);
});
connection.end();
});
}
Any suggestions are appreciated!