简体   繁体   中英

javascript Uncaught ReferenceError in asp.net MVC application

I'm kind of new to Javascript development and I'm having a problem when loading a specific View that uses a javascript file(created by me). When the page loads, I get the Uncaught ReferenceError.

IoTApp.createModule(

//some other functions here

[jQuery, resources, powerbi]);

In this module, when the Page Loads, it throws the Javascript Error, saying that: "resources is not defined"

I have also a "main" javascript that I load in the <head> tag of _Layout.cshtml:

<script type="text/javascript" src="~/Scripts/Views/IoTApp.js"></script>

The IoTApp.js is defined as bellow, where resources is defined:

var IoTApp =
{
    resources: {},
    createModule: function (namespace, module, dependencies) { 
    //Some code here
    });
}

Debbuging this Page, I can see that the IoTApp is loading in the Network option from the browser's developer tools.

Am I missing anything?

Tracing the code I could understand it better. Was just missing to create the resources object in the View that calls the Javascript code that uses "resources".

The resources object created in the IoTApp.js is not being used, so I removed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM