JavaScript runtime error: '$' is undefined

If you’re developing an MVC4 app and run into this error, you probably haven’t placed your scripts in the Script section.

Looking at the _Layout.cshtml file, you’ll see one of the last lines is

@RenderSection("scripts", required: false)

which will render a section titled scripts. The following is a sample:

@section Scripts
    <script type="text/javascript">
        $(function () {
            alert("JQuery loaded and working!!");

Here’s a link to the Gu man’s discussion of sections.

Cost me about 3 hours. Hope it saves you a few!!!


Unknown said…
Its Superb blog , if Rundll error problem go through this link and get free from error.
How To Remove Rundll Error
Thank you
Aalia lyon

Popular posts from this blog

JavaScript function to automatically add slashes to date

Migrating Legacy Apps to the New SimpleMembership Provider

Get Asp.Net Profile properties from Sql