So ive been given a task to link api calls to the frontend, however when I attempt to call the method using the "onclick" function nothing is happening. I've loaded the Javascript file within the head of the html document and also input the function name but still nothing is happening.
Can anyone please give me some sort of direction as to where I might be going wrong? really would appreciate it!
Can anyone please give me some sort of direction as to where I might be going wrong? really would appreciate it!
Head of html file.:
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="style.css">
<script src="toolbar.js"></script>
<script type="text/javascript" src="commands.js"></script> // this is the js file I want to use
<title>Document</title>
</head>
This is where I'm trying to call the function within the commands.js file.:
<div id="btnlogin" onclick="login()" class="standard-button" onmouseenter="hoverMouseOver(event)" onmouseleave="hoverMouseLeave(event)">
<img src="img/logon.svg" height="100%" width="100%">
<span class="tooltiptext">Log on</span>
</div>
This is how im calling the button in the commands.js file.:
function login(remoteDN)
{
var login = document.getElementById('btnlogin')
login.addEventListener('click', () => {
var data = {RemoteDN: remoteDN};
//var postData = new Login(RemoteDN)
JSON.stringify(data);