Jquery Load函数不引用母版页脚本文件 [英] Jquery Load function not referring master page script files

查看:68
本文介绍了Jquery Load函数不引用母版页脚本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序的 masterpage.html 中使用了jquery加载函数,它运行正常。但问题是我需要将Jquery.min.js放在我的所有内容页面中,以便在我的内容页面中使用jquery功能。我不想将它包含在所有页面中。它应该从我的母版页中引用。

I am using jquery load function in my application's masterpage.html and it is working fine. But the problem is i need to put Jquery.min.js in all my content pages in order to use jquery functionality in my content page. I don't want to include it in all pages. It should refer from my master page.

<html>
<head>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
<script type="text/javascript">

    function loadContent(pagename) 
    {
         $("#output").load(pagename);
    }
</script>

</head>
<body>
<a href="#" onclick="loadContent('about.html')">About</a>

<div id="output"></div>


</body>
</html>

about.html

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
<div id="content">
This is about page !!
 </div>

当你再次看到我的 about.html 包含jquery时在我的about.html页面中使用它。如何在所有页面中避免这种情况?请帮助

As you see my about.html again am including jquery in order to use it in my about.html page. How to avoid this in all pages ? Please help

推荐答案

我不能给你一个最好的答案,这些是我的建议

I can't give you a best answer, these is my advice


  1. jQuery文件最好包含在 body 标记的底部。

  2. 如果你使用jQuery,你必须包括它。

  1. the jQuery file had better include at the bottom in body tag.
  2. If you use the jQuery,you must include it.

这篇关于Jquery Load函数不引用母版页脚本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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