Quote:
There are no errors.
I'd be amazed if that was the case!
Check your browser's developer console, and you'll see that you have a syntax error in the rendered Javascript:
$('#license').text("Licensed To : " + Natasha Park);
You have an unquoted string literal, which is not valid Javascript.
If you want to emit a string variable from the server into your Javascript, you need to encode it properly. Fortunately, that's quite easy to do in ASP.NET Core:
@section Scripts
{
<script>
$('#license').text("Licensed To : " + @Json.Serialize(Model.getLicensedName()));
</script>
}
This should output:
$('#license').text("Licensed To : " + "Natasha Park");
which shouldn't produce any client-side errors.
But, as solution 1 said, you don't need to use Javascript to output server-site values in your markup. Just output the value directly where you want it to appear:
<div id="license">Licensed To : @Model.getLicensedName()</div>
ASP.NET will ensure that the value is properly HTML-encoded, so you won't get any nasty surprises if the returned value contains "special" characters.
Also, as solution 1 mentioned, in .NET it's preferable to use properties instead of Java's getter and setter methods.
Properties - C# Programming Guide | Microsoft Docs[
^]