开发者

What does the JScript IntelliSense error "Object expected @ 0:0" mean when compiling?

开发者 https://www.devze.com 2022-12-28 10:39 出处:网络
What does the JScript IntelliSense error \"Object expected @ 0:0\" mean when compiling with Visual Studio 2008?

What does the JScript IntelliSense error "Object expected @ 0:0" mean when compiling with Visual Studio 2008?

Error updating JScript IntelliSense: ascript.js: Object expected @ 0:0

Double-clicking the error drops the cursor into the aspx t开发者_开发技巧hat has the reference to the script file. The script file is listed in the aspx in a script manager.

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    <Scripts>
        <asp:ScriptReference Path="~/scripts/ascript.js" />
    </Scripts>
</asp:ScriptManager>    

The script file exists and starts with a document ready function that doesn't do any thing (other than occasionally pop an alert when the document is ready).

$(document).ready(function() { 
    //alert("Yep");
});

I'm sure that it's something really simple or that the error message is a red herring ...


Object expected @ 0:0

When you're using jQuery and this error appears, more often than not it's because the jQuery library isn't properly loading.

In my most recent case, the issue was my jquery.js file was corrupted. Make sure you have a valid jQuery file. If in doubt, download a fresh copy.

The other "gotcha" is making sure your HTML / ASP properly references the jQuery file.

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    <Scripts>
        <asp:ScriptReference Path="~/scripts/jquery.js" />
        <asp:ScriptReference Path="~/scripts/ascript.js" />
    </Scripts>
</asp:ScriptManager>  

Please let me know if this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消