How to reference Microsoft.JQuery.Unobtrusive.Ajax within my ASP.NET Core MVC project
I found that within the .NET ecosystem, Bower fills the void left by NuGet's inability to deliver static content files. Sow I need to use Bower to install the libraries that need to be accessible from the client side. Bower creates the required static content.
in my case, my asp.net core project was not set up to use Bower so I had to add a Bower configuration file to my project.
for references check this
Bower is deprecated and Libman should be used for new projects. However, jquery-ajax-unobtrusive
is not available in cdnjs yet. There are a few requests to add it, so feel free to vote on them. In the meantime, you can add it using unpkg
. The GUI for Libman doesn't currently show it, so you'll have to add it to the libman.json file manually:
{
"provider": "unpkg",
"library": "[email protected]",
"destination": "wwwroot/lib/jquery-ajax-unobtrusive/",
"files": [ "dist/jquery.unobtrusive-ajax.js", "dist/jquery.unobtrusive-ajax.min.js" ]
}
If you want to get all the files in the library, remove the last line, but those two JavaScript files are all you need.
Currently, the latest version hosted on Microsoft's CDN is 3.2.5. If you wanted the 3.2.6 version, the only CDN that hosts it at the moment is jsdelivr.com:
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.unobtrusive-ajax.min.js"
integrity="sha256-PAC000yuHt78nszJ2RO0OiDMu/uLzPLRlYTk8J3AO10="
crossorigin="anonymous"></script>