0

Could anyone tell me how to get this code working on a web server. It works fine locally but the calculations don't work online. What has gone wrong? The html file is in the same folder as the jquery.js file.

http://jsfiddle.net/nyree/3CgcH/

thanks in advance for any help

1
  • What's the link to your site? Your fiddle doesn't represent the actual issue. Commented Mar 9, 2012 at 17:41

1 Answer 1

5
<script type="text/javascript" src="/spreadsheets/jquery.js"></script>
<script type="text/javascript" src="YUI/yahoo-min.js"></script>
<script type="text/javascript" src="YUI/yahoo-dom-event.js"></script>

<link rel="stylesheet" type="text/css" href="YUI/fonts-min.css" />                       
<script type="text/javascript" src="YUI/cookie-beta-min.js"></script>
<script type="text/javascript" src="YUI/cookie-min.js"></script>
<link rel="stylesheet" type="text/css" href="YUI/tabview.css" />
<script type="text/javascript" src="YUI/element-beta-min.js"></script>
<script type="text/javascript" src="YUI/tabview-min.js"></script>
<link rel="stylesheet" type="text/css" href="YUI/container.css" />
<script type="text/javascript" src="YUI/container-min.js"></script> 

None of these files exist on jsFiddle's server. You need to change your reference URLs.

What exists on your server has nothing to do with what exists on jsFiddle's server.

jsFiddle only knows a part of the path, /spreadsheets/jquery.js. That is a relative URL to their server. If you want your code to work on someone elses server, you either need to be able to put the files on their server to maintain the path structure, or change the URLs to be absolute.

<script type="text/javascript" src="http://YOURWEBSITE.com/spreadsheets/jquery.js"></script>
Sign up to request clarification or add additional context in comments.

5 Comments

but they are all on my server, so why shouldn't it work? Sorry to appear so dim, I am new to javascript
what should I change them to - can you give me an example please?
It is looking for the javascript files relative to the website. jsfiddle.net/YUI/yahoo-min.js (does not exist). It does not know that it is on your server or how to get to it unless told. This would be by using yourserver/YUI/yahoo-min.js or similar for the rest of the js files.
These responses don't explain what is happening - it WORKS perfectly on jsfiddle (without the files on their server) it DOESN'T work correctly on my server (even though I've uploaded the files to a directory called spreadsheets, with the html file included) this is what I don't understand!
@user1236274, Do you have a link so that we can actually see the issue? Because jsFiddle should not work at all as it has none of the files.

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.