title: Combining jQuery.load() and ajax dataFilter()
body: <p>I was using jQuery.load() to load a html page's content into a lightbox. The most useful thing load does in this instance is turning full html pages into a clean html fragment to be inserted into the page.</p>
  
  <p>But (because of a buggy 3rd party API which won't work when loaded dynamically), I need to first use a regex to filter out one or two elements from the page before it gets processed as html, which means I need to use the dataFilter option of $.ajax.</p>
  
  <p>So now that I'm using $.ajax instead of .load I need to convert my filtered text into the clean html that .load delivers automatically</p>
  
  <p>But $(response) generates a strange buggy jQuery object where .find(), children() etc... don't work.</p>
  
  <p>Can anyone tell me how to get the clean html I need (I notice the ajax code injQuery has changed a lot from v 1.4.4 to 1.5 - a solution using either version would do)</p>
  
  <p>Here's what I have so far (using jQuery 1.4.4) (all the variables and methods referenced are defined above this code)</p>
  
  <pre><code> $.ajax({
              url: url,
              type: "GET",
              dataType: "html",
              dataFilter: function (response) {
                  return response.replace(recaptchaRegex, "");
              },
              success: function (response) {
                  // If successful, inject the HTML into all the matched elements
                  // See if a selector was specified
                  destination.html($(response).children("#lightBoxForm"));
  
                  callback();
              }
          });
  </code></pre>