title: jquery html() strips out script tags
body: <p>I need to replace the content of a div in my page with the html resultant from an ajax call.
  The problem is that the html have some necessary scripts in it and it seems that jquery html() function stripts them out,
  I need to filter the response and only get a specific div. </p>
  
  <p>I am thinking on a workaround which is to extract all the script tags from the ajax response and then append them do the DOM but i am having trouble doing that.</p>
  
  <p>Here is my code;</p>
  
  <pre><code>   $('a.link-vote').live('click',function(){
          var idfeedback = $(this).attr('id').split('-')[1];
          var href = $(this).attr('href');
          $('.feedback-' + idfeedback + '-loader').show();
          $.ajax({
              type: "POST",
              url: href,
              success: function(response){
                 var x = $(response).find('#feedback-'+ idfeedback).html();
                 $('.feedback-' + idfeedback + '-loader').hide();
                 $('#feedback-'+ idfeedback).html(x);
  
              }
          });
          return false;
      });
  </code></pre>
  
  <p>I found this old topic:
  <a href="https://stackoverflow.com/questions/2699320/jquery-script-tags-in-the-html-are-parsed-out-by-jquery-and-not-executed">jQuery - script tags in the HTML are parsed out by jQuery and not executed</a></p>
  
  <p>but the is any conclusion. I tried the solutions suggested there but none of them work.</p>
  
  <p>EDIT:
  I seem to found a workaround based on that old topic but it´s not pretty;</p>
  
  <pre><code>  var dom = $(response);
                  // var x = $(response).find('#feedback-'+ idfeedback).html();
                  $('.feedback-' + idfeedback + '-loader').hide();
                  //$('#feedback-'+ idfeedback).html(x);
  
                  $('#feedback-'+ idfeedback).html(dom.find('#feedback-'+ idfeedback).html());
  
                  dom.filter('script').each(function(){
                      var obj = $(this);
                      $('#feedback-'+ idfeedback + ' .feedback-comments').append(obj);
                  });
  </code></pre>
  
  <p>There must be a easy way.</p>