引用Jquery语句和调试 [英] Referencing Jquery statements and debugging

查看:123
本文介绍了引用Jquery语句和调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS2008。

我有一个MVC应用程序,我为我正在建立的控件动态渲染html

I have an MVC app and I dynamically rendering html for a control I am building.

我已经写了一些javascript并放入了一个.js文件。

I have written some javascript and put in a .js file.

我的主页有一个引用到我的jquery js文件。

My master page has a refernce to my jquery js file.

一个用户控件然后调用我的代码来呈现html。

A user control then calls my code to render html.

我的js文件使用JQuery。

My js file uses JQuery.

当我调试我在立即窗口中打印
语句时收到未定义错误。

When i debug i am getting an "undefined" error when printing the statement in Immediate Window.

这是因为我的js文件不引用Jquery JS文件?

Is this because my js file does not reference the Jquery JS file?

如果是这样,请参考它?

If so how do I reference it??

Malcolm

推荐答案

Malcom,

确保您的jQuery引用正在解析 - 您可以使用 firebug ,或者您可以在Web服务器启动时测试该URL。我绝对同意,在做JS / UI开发时, firebug 是必须的!

Make sure that your jquery reference is resolving -- you can use firebug, or your can just test the url out while the web server's up. I definitely agree that having firebug around when doing JS/UI development is a must!

在加载页面时查找脚本参考...您可以复制URL并通过粘贴到浏览器中进行测试...例如,如果您在网站的URL(< a href =http:// localhost:1234 / =nofollow noreferrer> http:// localhost:1234 / ),看看:

Look for the script reference when you load your page... You may copy the url out and test by pasting in the browser... for example, if you view source on your web site's url (http://localhost:1234/) and see:

<script type="text/javascript" src="scripts/jquery-1.3.2.js"></script>

输入 http:// localhost:1234 / scripts / jquery-1.3.2.js ,看看是否收到JS内容(或者被提示下载)。

enter http://localhost:1234/scripts/jquery-1.3.2.js in your browser and see whether you receive the JS content (or are prompted to download).

希望这有帮助。

Seth

这篇关于引用Jquery语句和调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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