Search code examples
joomla2.5joomla-extensionsjoomla-template

unable to load jquery through google server in ja_orisite joomla template


I am using JA_Orisite template of joomla2.5 for my client, and unable to load jquery file "//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"(needed for menu and article scrollings, etc), This file was being loaded on localhost, when I transfered the site using akeeba backup and recovery process, after installation on server I am unable to load jquery.

Surprisingly, I was having file permission issues on server, once I set 777 to all the files of my site, Jquery file was also working properly.

As the first server is not providing me the expected speed and service, I have transfered the site to other hosting server, which is now giving the same problem of jquery, On this server too I tried to set the permissions to 777, and yet unable to load jquery files.


Solution

  • Rather than importing it from Google, you could always import a local version like so:

    <?php
      // load jQuery, if not loaded before
      if(!JFactory::getApplication()->get('jquery')){
         JFactory::getApplication()->set('jquery',true);
         $document = JFactory::getDocument();
         $document->addScript(JURI::root() . "templates/template_name/js/jquery.js");
      }
    ?>