I'm trying to use the toastr library within my .NET Core 3.1 Project.
I've added the client side librarys
I've also included the references in my head tag in my .cshtml razer file:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
<link href="~/lib/toastr.js/toastr.css" rel="stylesheet" />
<script src="~/lib/toastr.js/toastr.min.js"></script>
<script src="~/lib/jquery/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The issue I'm facing is when I try to use toastr above I get the error "Uncaught referrence error: toastr is undefined"
<script> toastr.success("s");</script>
Any suggestions would be appreciated!
Could be you are trying to run toastr before it is fully defined. It works fine here:
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script> toastr.success("s");</script>