0

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.fbAsyncInit = 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

9
  • 2
    Can you load jquery.js using your browser's URL bar? Why not use a CDN for jQuery, anyway? Commented Apr 27, 2011 at 2:45
  • What happens if you put the page's address in the browser and replace the page name with the script name? Commented Apr 27, 2011 at 2:46
  • my firebug says 404 not found and after I typed in the url in the url bar, it is blank, no result. Thank you Commented Apr 27, 2011 at 2:48
  • it is like domain/jquery.js 404 not found. Commented Apr 27, 2011 at 2:50
  • Seems, you do not have those js files in your application root. Commented Apr 27, 2011 at 2:51

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

they are in the same folder, which is weird.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.