I have a function in HTML that I want to be able to call, but I don't know how to call it.
Inside the HTML script I have a function named CreateCard that is created at the end of the script.
Inside another script (my webserver), I'm trying to call it like this:
app.get('/', function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' })
fs.readFile('./https/home.html', function(err, data) {
if (err) {
console.log("ERROR, ERROR")
res.writeHead(404)
res.write('Error | File Not Found')
} else {
res.write(data)
let limiteds = GetLimiteds()
limiteds.forEach((itemData) => {
if (client.get(GetKey(itemData.itemID, itemData.itemClassName)) && client.get(GetKey(itemData.itemID, itemData.itemClassName)) != 0) {
data.CreateCard(itemData.itemName, itemData.itemClassName, itemData.itemID, client.get(GetKey(itemData.itemID, itemData.itemClassName)), itemData.MaxAllowed)
}
})
}
res.end()
})
});
How can you call the function inside the JavaScript file?