Search code examples
jqueryversions

Load external page with different jQuery version


Is it possible to load another page with a different jQuery version?

I have an HTML page with a membership system that uses jQuery 2.1.3 and am trying to load an external PHP page with a scroller effect that uses jQuery 1.10.3.

The PHP page works fine on its own, but when I try load it using GET, LOAD, methods I get these errors:

TypeError: $.widget is not a function jq.js line 2 > eval:1:40
TypeError: $(...).smoothTouchScroll is not a function

Solution

  • As i understand it, issue comes from your new loaded page include an other jq version, you should exclude it using:

    $.get('scroller.php', function(html) {
         var markup = $($.trim(html));
         $('script[src*="1.10.3"]', markup).remove();
         $('#res').html(markup);
    });