0

I've developed a web app. It uses jQuery, for the development I used it dowloading it from google like this:

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

But the app is going to run without access to internet, so I changed that line so jQuery is downloaded from the local webserver like this:

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

And this doesn't work!! It's driving me crazy, I don't understand why. The jQuery file of course is in ther server, and it's properly dowloaded:

enter image description here

Any idea?!

Chrome gives me the following error:

enter image description here

Everything works fine if I download the library from google!! What's happening?!

It's exactly the same version because to get the library I just went to the link from google and download it. I also tried with the latest version available at jQuery.com but the same problem...

I tried to re download the jQuery from google and from jquery.com and it still doesn't work... I tried to just load the jQuery library and nothing else but still doesn't work, here is the image of the warning of the developer tools:

enter image description here

New update:

I did exactly the same in an other computer and it does work! So the problem must be in my apache when it serves the file, It's that possible or I'm making up things? The other computer has exactly the same php + apache config... so weird...

Andres
  • 11,439
  • 12
  • 48
  • 87
  • do you have any other library loaded? do you have other js files loaded before the jquery load? You may have some script that doesn't end properly – JMax Dec 17 '11 at 17:52
  • 1
    Check http://stackoverflow.com/questions/4742467/circumventing-chrome-access-control-allow-origin-on-the-local-file-system if you're serving files locally this might be the problem – c4urself Dec 17 '11 at 17:54
  • @JMax In the last try I just left the jQuery library to load and It still giving me an error... The jQuery library it's now working, I don't know what may be the difference between loading it locally than from google... it's the SAME file... I'm completely lost here... – Andres Dec 17 '11 at 18:20

1 Answers1

0

There seems to be something wrong with your copy of the jquery.min.js. Try downloading it again and replacing the file. Go for the latest version, jquery-1.7.1.js. You should not be getting syntax errors in that file.

Benny Johansson
  • 761
  • 6
  • 18
  • That is strange. Have you cleared the browser cache in between? You could also temporarily change the name of the jquery.min.js file to something else just to make sure you are not running off a browser cached copy of the file. – Benny Johansson Dec 17 '11 at 18:20
  • In your resources tab in Chrome dev tools, can you check that your jQuery file ends with '(window);'? I thought I had was that your web server might cut the file short for some reason. – Benny Johansson Dec 17 '11 at 18:32
  • "("jquery",[],function(){return f})})(window);" that's how it ends... it seems to be complete! It's really really weird, in my other computer (notebook) it works just fine!!! And I also try it accessing the page from the one that fails and it works when it is served from the notebook (the one that works...) – Andres Dec 17 '11 at 19:02
  • That is seriously strange. Different browsers? >_ – Benny Johansson Dec 17 '11 at 20:32
  • Same problem with different browsers... I thing it must be something related with how my apache serve the file because I did the same thing in an other apache installed in other computer and it just works... I have to make a clean install to see if the problems get solved... – Andres Dec 18 '11 at 19:26
  • Maybe your apache had some strange character encoding settings. Got to love technology sometimes. :/ – Benny Johansson Dec 18 '11 at 22:08