0

I have tried this:

  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
  <script src="//ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
  <script src="//ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js type="text/javascript"></script>
  <link  href="@Url.Content("~/Content/Stylesheets/selectbox.css")" rel="stylesheet" type="text/css" />
  <script src="@Url.Content("~/Scripts/jquery.selectbox-0.5.js")" type="text/javascript"></script>
  <script type="text/javascript">
      window.jQuery || document.write('<script src="/Scripts/jquery/jquery-1.6.1.min.js">\x3C/script>')
      window.jQuery || document.write('<script src="/Scripts/jquery/jquery.unobtrusive-ajax.min.js">\x3C/script>')
      window.jQuery || document.write('<script src="/Scripts/jquery/validate.validate.min.jss">\x3C/script>')

If I'm not connected to the internet and running locally then it just hangs. Is there just one good recommended way to load up external javascrpt such as those from google. Maybe something that I can code into my view that checks if the internet is available and then if not it loads local scripts?

TonyG
  • 1,645
  • 2
  • 14
  • 17
  • You may find the answer here: [Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail](http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-goo) – Wesley Murch May 28 '11 at 05:49

1 Answers1

0

one more option to detect jquery plugins are available/loaded or not::

if(typeof jQuery.fn.**PLUGIN_FUNCITON_NAME** == 'function'){
    //jQuery plugin calling goes here
}

but it must be called after jQuery itself loaded successfully... for to check jQuert, try this:

if (typeof jQuery == 'undefined'){
    //jQuery scripting goes here
}
Vaibhav Gupta
  • 1,592
  • 1
  • 13
  • 23