javascriptjquerywhmcs

jquery.js / whmcs integration


I have a problem with integrating my header and footer in whmcs. Everything works perfectly. Although a strange problem came along. It has something to do with the jquery.js file in my custom layout.

when I comment out the jquery.js in my footer.tpl the dropdown menu in the header does not work on pages where whmcs generates tables. (invoices and domains) But when I do use that jquery file the tables are still generated fine and the menus work, but then I can't order domains. No button or text fields appear when ordering a domain.

I know this is not a good and a vague question but this has got me puzzled for quit a while now.

Anyone with who can push me in the right direction to find a solution? Or someone with a similar experience with whmcs integration?

thanks in advance!!


Solution

  • Not sure if you found a solution on this, but likely the culprit is one of two things:

    1) The jquery library loading second is clobbering the first one so it no longer exists. To fix this you should call jQuery.noConflict(); prior to loading the second jquery library, this way the $ shortcut gets pushed over to use jQuery and frees up the $ for the new jquery. This however may become a problem if any of the javascript relies on the $ shortcut and must point to the first jQuery library, in which case all shortcuts should be renamed to jQuery.

    2) The scripts executing the later jQuery library aren't compatible. This can be problematic if the versions are very different as some methods and capabilities have changed over time.

    Best thing to do is always to use only one jQuery library, and use the newest one if possible. Older scripts that rely on the older jQuery should be updated if possible.