Microsoft JScript运行时错误:"jQuery"未定义 [英] Microsoft JScript runtime error: 'jQuery' is undefined

查看:250
本文介绍了Microsoft JScript运行时错误:"jQuery"未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个ASP MVC 3 noobie,通过音乐商店教程

I am an ASP MVC 3 noobie working my way through the music store tutorial http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-5

我已经通过添加/编辑/删除操作成功添加了StoreManager控制器.控制器正常工作-我能够执行这些操作.但是途中,Visual Studio会显示弹出窗口,显示"Microsoft JScript运行时错误:'jQuery'未定义".我只是忽略了这些错误,一切运行正常.

I have successfully added a StoreManager controller with Add/Edit/Delete operations. The controller works--I am able to perform these operations. But midway thru, visual studio shows pop ups that say "Microsoft JScript runtime error: 'jQuery' is undefined." I just ignore these errors and everything runs fine.

SO帖子已更新的JQuery-获取Microsoft JScript运行时错误:"jQuery"未定义似乎暗示我的packages.config文件可能存在问题.我需要在此文件中修复某些错误,以使该错误消失吗?如何确定已安装jQuery并将其正确连接到MVC3/Visual Studio?我假设在安装带有MVC 3组件的SP1时包括了jQuery.

The SO post Updated JQuery - get Microsoft JScript runtime error: 'jQuery' is undefined seems to imply that there might be a problem with my packages.config file. Is there something I need to fix in this file to make this error go away? How can I be sure that jQuery is installed and properly hooked up to MVC3/Visual Studio? I assume that jQuery was included when installed SP1 with the MVC 3 components.

这是我的packages.config文件:

Here is my packages.config file:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="jQuery" version="1.5.1" />
  <package id="jQuery.vsdoc" version="1.5.1" />
  <package id="jQuery.Validation" version="1.8.0" />
  <package id="jQuery.UI.Combined" version="1.8.11" />
  <package id="EntityFramework" version="4.1.10331.0" />
  <package id="Modernizr" version="1.7" />
</packages>

推荐答案

这意味着您对jQuery * .js的脚本引用已损坏,当另一个脚本厌倦调用jQuery时,将引发此错误.

This means that your script reference to jQuery*.js is broken, when another script tires to call jQuery this error is thrown.

通常在_Layout.cshtml中查看您的标记,然后找到<script>引用.应该有一个与<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>

Look at your markup usually in _Layout.cshtml and find the <script> references. There should be one similar to <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>

如果您已使用包管理器更新了jQuery,则需要更新参考中的版本号. "~/Scripts/jquery-<version>.min.js"

If you have updated jQuery using the package manager, the version number in the reference needs to be updated. "~/Scripts/jquery-<version>.min.js"

  1. 确保路径有效.
  2. 确保其第一个脚本 引用.
  3. 使用Chrome/IE/FireFox调试工具进行测试
  1. Make sure the path is valid.
  2. Make sure its the first script referenced.
  3. Test using Chrome/IE/FireFox debug tools

这篇关于Microsoft JScript运行时错误:"jQuery"未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆