Jquery from cdn

How to load the following into cdn and if they don't work, I will upload my local file if it doesn't work

  • Google CDN : jquery.min.js and jquery-ui.min.js.
  • Microsoft CDN: jQuery.Validate.min.js
+4
source share
7 answers

fOR jQUERY

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/scripts/jquery-1.3.2.min.js' type='text/javascript'%3E%3C/script%3E")); //local } </script> 

For jQuery Ui

 if (jQuery.ui) { document.write(unescape("%3Cscript src='/scripts/jqueryui-1.8.2.min.js' type='text/javascript'%3E%3C/script%3E")); //local } 

To check jquery

 if(!jQuery().validate) { document.write(unescape("%3Cscript src='/scripts/jquery.validate.min.js' type='text/javascript'%3E%3C/script%3E")); //local } 

Links MS validate.js - http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js

Google jquery.min.js - http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js

Google jquery.ui.js - http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js

Google JqueryUi theme- (change the database to one of the main topic names) http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css

+1
source

this is how the guys from html5boilerplate.com do it

 <!-- Grab Google CDN jQuery, with a protocol relative URL; fall back to local if necessary --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/libs/jquery-1.5.1.min.js">\x3C/script>')</script> 
+14
source

You can check if the jquery object exists after the file is included, so you have a fault tolerant (very rare)

 <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/scripts/jquery-1.3.2.min.js' type='text/javascript'%3E%3C/script%3E")); //local } </script> 

So, for the links you requested

MS validate.js - http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js

Google jquery.min.js - http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js

Google jquery.ui.js - http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js

Have a look at this question: Microsoft CDN for jQuery or Google CDN? They also talk about your problem.

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

jQuery: https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js

jQueryUI: https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js

for more information. http://code.google.com/apis/libraries/devguide.html#jquery

to backup something like this.

 <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/path/to/your/jquery' type='text/javascript'%3E%3C/script%3E")); } if (typeof jQuery.ui == 'undefined') { // UI Not loaded document.write(unescape("%3Cscript src='/jquery.ui.js' type='text/javascript'%3E%3C/script%3E")); } </script> 
+2
source
+2
source

Check this box to check if jquery is loaded or not.

For jQuery download this will certainly help you.

You can also check if the validate plugin is loaded or not on here .

+1
source

Already answered similar questions in jquery ui - how to use Google CDN

You can make a call using

 <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> 

You can also download jQuery from Microsoft CDN in

 <script src=" http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js" type="text/javascript"></script> 

You can also link to other Ui themes by changing the name of the theme. In this case, change the name base to any other topic name /base/jquery-ui.css to any other topic.

 <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" /> 

Check out the jQuery UI Blog for all CDN links http://blog.jqueryui.com/

If you want to return to your computer in case of Google failure, you can do

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='/jquery.js' type='text/javascript'%3E%3C/script%3E")); } </script> 
+1
source

Source: https://habr.com/ru/post/1345047/


All Articles