Hello guys
Currently following the " Learn BSC Programming (Binance Smart Chain) FULL COURSE" on Youtube and for some reason dApp isn’t connecting to the Moralis Server.
Console.log throws the following message
i looked for potential issues like changing the source from “latest” to @0.0.37 etc but this resulted in more issues.
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
Thank you for your help,
Dex
index.html file
<!DOCTYPE html>
<html lang ="en">
<head>
<title> BSC Dapp </title>
<!--ref link to skip CSS-->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
</head>
<body>
<main>
<div class="container">
<div class="mt-2 mb-2">
<h1> BSC Tracker</h1>
</div>
<div class="mt-2 mb-2">
<input id="username" type = "text" class="form-control" placeholder="Username">
</div>
<div>
<input id="email" type = "text" class="form-control" placeholder="E-Mail">
</div>
<div class="mt-2 mb-2">
<button id="login" class = "btn btn-dark" onclick="login();">Connect Metamask</button>
</div>
</div>
</main>
<!--SCRIPTS-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="https://unpkg.com/moralis/dist/moralis.js"></script>
<script src="static/logic.js"></script>
</body>
</html>
logic.js file
Moralis.initialize("9xPG6EnH2JW77pGfdcSZzHZCCP4Yd28csymO4Dcv");
Moralis.serverURL("https://qejutygvunvz.moralisweb3.com:2053/server");
var user;
async function login() {
Moralis.Web3.authenticate().then(function (user){
user.set("name", document.getElementById("username").value);
user.set("email", document.getElementById("email").value);
user.save();
deactivateControls();
console.log("login clicked");
})
}
function deactivateControls() {
document.getElementById("login").setAttribute("disabled", null);
document.getElementById("username").setAttribute("disabled", null);
document.getElementById("email").setAttribute("disabled", null);
}```