So I'm relatively new to Dot Net Core stuff so bear with me.
My end goal is to call C# code from Javascript code in my project and vice-versa. So if there's a simpler way than what I'm doing then that would be awesome. I'm trying to follow the tutorial here to run a C# function from js:
The issue I'm having is in the second window of code on the webpage, here is the line (it is javascript code):
DotNet.invokeMethodAsync('BlazorSample', 'ReturnArrayAsync')
.then(data => {
data.push(4);
console.log(data);
});
I am getting an error when trying to run this function on my own dot net core site: "Uncaught ReferenceError: DotNet is not defined". I've been googling as many things as I can, and I can't seem to find any reasons for having that error. I can't find any import/require type statements I could put and since I'm new to DotNet Core I'm really stuck. Does anyone know how I can get this module in the javascript, or other ways I can achieve this?