26
votes

I need to load the jQuery UI files, and would like to do it from Google. Currently I upload:

<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.draggable.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.droppable.js"></script>

What are the corresponding files I need from Google?

Can I use http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js?

Also, is there any disadvantage in using this one instead: http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js ?

3
The 'latest' link has been taken down, but this gives the latest (at least until we hit version 2): ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.jsharvest316

3 Answers

34
votes

Yep. It's as simple as that.

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>

You could use Google's loader to load it but you don't really need to.

The only real disadvantage to using the min one is that the code is compressed so if you wanted to step through it with a debugger, it would be quite difficult to say the least. The advantages far outweigh this though. In production, I would say by all means use the min one.

11
votes

The previous answer gives you a link to a specific version of jqueryui but your question implies that you'd like the Google-based links to the latest versions. These are the correct src's:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>

I see that we're up to version 1.9x at the time of writing. I don't know if the "1" in Google's links will change to a "2" if/when we reach jquery v2. The above links will give you the latest files, anyway, in version 1.

This method doesn't seem to be documented on Google's hosted libraries page, so use with caution. Also the various extra libraries such as draggable / droppable that you've referred to don't seem to be hosted on Google.

See: https://developers.google.com/speed/libraries/devguide?hl=fr#jquery

0
votes

you have to paste 2 elements:

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

as the developers.google.com site says