Hi,
I have newly installed Visual Studio 2017. And in that I have added new ASP.NET MVC Core application. After doing this I have just added JQuery reference using Nuget. Once I done will all this configuration part, I have added 1 method in Home Controller MyUtilityView() which returns a simple view. On this 'MyUtilityView' view I have added <script> tag. And in that I have added
$(document).ready(function () {
alert('Hello World');
});
After executing this application in developer tool of browser I am getting 'uncaught reference error $ is not defined'.
So I tried to add Jquery reference in bundleconfig.json. For this I hunt more than 5 - 6 hrs. now but haven't get exact solution. So finally I did following changes in bundleconfig.json file.
[
{
"outputFileName": "wwwroot/css/site.min.css",
// An array of relative input file paths. Globbing patterns supported
"inputFiles": [
"wwwroot/css/site.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/site.js",
"wwwroot/lib/jquery/dist/jquery.js",
"wwwroot/lib/jquery/dist/jquery.min.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js"
],
// Optionally specify minification options
"minify": {
"enabled": true,
"renameLocals": true
},
// Optionally generate .map file
"sourceMap": false
}
]
It gets compiled properly but gave me same error as described early. Can any buddy help me as I am new for VS 2017 & .MVC Core both. And explain me what all the ways to add new Jquery references in bundleconfig.json
Thanks in advance...
Regards,
Avinash Phade.