We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30100
    • 58 Posts
    I use jquery for on my site loaded from google in the html head but when I try to add ajaxsearch to the page the rest of the jquery functions on my page stops working. If I remove ajaxSearch everything is fine again. I tried setting &addJscript=`0` in the call but that makes ajaxsearch stop working. There must be many of you that uses both ajaxSearch and jquery but how do you make it work?

    in html head:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

    ajaxSearch call:
    [!AjaxSearch? &extractLength=`50` &addJscript=`1` &ajaxSearch=`1` &otherParamsAsNeeded=`here` &ajaxSearchType=`1` &highlightResult=`1` &tplLayout=`template_ajax_search_form2` &showMoreResults=`1` &ajaxMax=`5` &moreResultsPage=`79`!]

    Oh, and modx version 0.9.6.2 and ajaxSearch 1.8.1b
      • 10449
      • 956 Posts
      That’s because the AjaxSearch is hijacking the $ shorthand for its own usage:
      function setActiveStyleSheet() {
      var el= $(’modxhost’);
      etc.

      Use jQuery in no-conflict mode instead. We just had a similar thread about it recently: http://modxcms.com/forums/index.php/topic,30687.0.html
        • 30100
        • 58 Posts
        Thank you that solved it I’m now calling jquery first and then use jQuery(’id’).css(....) instead of $(’id’).css(....)

        Direct link from other thread:
        http://docs.jquery.com/Using_jQuery_with_Other_Libraries

        Thanks again! laugh
          • 25321
          • 18 Posts
          Not found file js/ajaxSearch-jquery.js in version:1.8.1 for jQuery.
          Where to get this file?
            • 5811
            • 1,717 Posts
            See http://modxcms.com/forums/index.php/topic,31325.msg189986.html#msg189986

            For the moment, the JQuery implementation of JQuery is not effective. For that A port of the ajaxSearch.js file to JQuery API is necessary.
              • 36507
              • 9 Posts
              I added my own "modx’d" version of slick slideshow (similar idea to easyslider) and I was having issues with ajax search conflicting with jquery as well. I just wanted to say thank you. All I did was a find "$" and replace all with "jQuery" (minus quotes of course) in my slideshow javascript and it began working. Apparently jQuery uses the $ as a variable for "jQuery" to reduce the size (I’m guessing) and it conflicts with other libraries.

              I found the link to jquery and it’s instructions a little confusing and various instructions recommending porting and modifying ajaxsearch, for me the newbie grin so I just wanted to keep it simple and let people know, that I didn’t touch ajaxsearch at all but instead modified the javascript that I added that was conflicting using the replace technique above. (it worked for me but no guarantees)

              open your javascript file, that depends on the jQuery library that you are adding, in Notepad

              Find... $

              Replace all... jQuery

              So again thanks to all who posted this info (save me potentially ALOT of time as I would have never figured that out on my own).