title: Uncaught TypeError: Cannot read property 'ownerDocument' of undefined
body: <p>I'm teaching myself AJAX to AJAXify my site. In my template, I have the following JS code to get some JSON data from a view then append the data to a div.</p>
  
  <pre><code>function filter(type) {
    $.getJSON(
      '/activity_stream/global-activity-stream/', 
      {xhr: "true", filter: type}, 
      function(data) {
        $('.mainContent').children().remove();
        $(data).appendTo('.mainContent');
      });
    }
  
    $(".btn").click(function () { 
      filter("recent"); 
    });
  }
  </code></pre>
  
  <p>I think my view is returning proper JSON but now data is not being added to the <code>.mainContent</code> div. </p>
  
  <p>It gives this error: </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'ownerDocument' of undefined. </p>
  </blockquote>