开发者

Cant load jquery

开发者 https://www.devze.com 2023-02-28 18:42 出处:网络
I am using the JavaScript SDK from facebook and I just did the what the example says to load it.This is the sample codes.

I am using the JavaScript SDK from facebook and I just did the what the example says to load it.This is the sample codes.

<body>
<div id="fb-root"></div>
<script>


  window.fbAs开发者_如何转开发yncInit = function() {
    FB.init({appId: '{{ facebook_app_id }}', status: true, cookie: true,
             xfbml: true});
    FB.Event.subscribe('{% if current_user %}auth.logout{% else %}auth.login{% endif %}', function(response) {
    window.location.reload();
    });
  };
  (function() {
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="FetchPic.js"></script>
</body>

But the problem is the all.js from facebook can be loaded successfully but neither jquery nor FecthPic can be loaded, it just keep saying 404 not found. but both of them are in the same directory as the html file. I have no idea why. Thank you


Do this instead

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

where you have

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

or fix the path for your local jquery instance


Small expansion on hacknick's response:

Your script tags:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="FetchPic.js"></script>

are telling the browser to load the scripts from the same folder as the page (HTML or whatever) that's being displayed. I imagine that's not where they are located.

0

精彩评论

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