jQuery .load() but exclude script tags -


i using following jquery load in 5 pages current page

$('.main').load('main.cfm'); $('.bu1').load('bu1.cfm'); $('.bu2').load('bu2.cfm'); $('.bu3').load('bu3.cfm'); $('.bu4').load('bu4.cfm'); 

but each .cfm has following script tags in them

            <script src="js/jquery.speedometer.js"></script>              <script src="js/jquery.jqcanvas-modified.js"></script>              <script src="js//excanvas-modified.js"></script>              <script>             $(function(){                 $('#mdtq').speedometer({                     backgroundimage: "url(speedo/background-r.png)",                     maximum: 15,                     scale: 15,                     suffix: ''                 });                  $('.changespeedometer').click(function(){                     $('#mdtq').speedometer({ percentage: $('.speedometer').val() || 0 });                 });             });             </script> 

is there way remove below pages below whilst being loaded?

$('.bu1').load('bu1.cfm'); $('.bu2').load('bu2.cfm'); $('.bu3').load('bu3.cfm'); $('.bu4').load('bu4.cfm'); 

thanks

as load shortcut $.get convenience of automagically inserting content you, can use , filter out script tags before inserting content yourself:

$.get('bu1.cfm', function(html) {      var markup = $($.trim(html));      markup.find('script').remove();       $('.bu1').html(markup); }); 

edit:

to filter src:

$.get('bu1.cfm', function(html) {      var markup = $($.trim(html));      $('script[src]', markup).remove();      $('.bu1').html(markup); }); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -