I use the MVC4 default template.
I add a script : MyScript.js
in /Scripts/MyApp/
with a function :
function Testing()
{
alert('test');
}
In the global.asax :
bundles.Add(new ScriptBundle("~/bundles/myapp").Include(
"~/Scripts/MyApp/MyScript.js"));
I'd like call this method in /Views/Home/Index.cshml
I tried the code below but without success:
<script type="text/javascript" lang="javascript">
$(document).ready(function () {
Testing();
});
</script>
@Scripts.Render("~/bundles/myapp")
When I look the source code the link to MyScript.js
is there and I can navigate to it (go to the source)
But the Testing()
method in the $(document).ready
is not executed.
Update1
<script type="text/javascript" lang="javascript">
$(document).ready(function () {
alert("test");
});
</script>