We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6038
    • 228 Posts
    Is there an easy way to get AjaxSearch to insert its script tags before the closing body tag, rather than before the closing head tag?

    I have moved all my other javascript to the just before the closing body tag as part of a performance improvement - but the ajaxsearch script is bombing my javascript because it uses jquery is loaded later in the page.

    The site I’m referring to is using AjaxSearch v1.9.2 with Modx v1.0.5

    Thanks!
      • 4310
      • 2,310 Posts
      Around line 884 in assets/snippets/ajaxSearch/classes/ajaxSearchOutput.class.inc.php you’ll see function setAjaxSearchHeader()
      You could try changing the instances of
      $modx->regClientStartupScript
      to
      $modx->regClientScript

      Untested so back it up first!
        • 6038
        • 228 Posts
        GOLD! Exactly what i was looking for... i should have known this - I’ve used it in a Revolution site before, but didn’t realise it was also in Evo - duh!

        Anyway, it has moved my javascript - but I havn’t quite figured out whether that has caused any problems yet, as I’m still grappling with the MinJS snippet which is having a hard time dealing with compressing my jquery...

        thanks bunk58!
          • 4310
          • 2,310 Posts
          No problem wink