如何操作JQuery .get()响应

Using a suggestion found at http://richardmiller.co.uk/2011/03/04/jquery-manipulating-ajax-response-before-inserting-into-the-dom/ to be able to manipulate my data response from a JQuery .get() method, I'm unable to actually make any changes to the object.

JavaScript

$.get( "returnAjax", function( data ) {
    var $data = $(data);
    $data.find('#testdiv').append('<p>Some Text</p>');
    console.log($data);
});

PHP

public function returnAjax()
{
    return "<div id='testdiv'></div>";

}

The output in the console is simply <div id="testdiv"></div>

This seems like the most simple thing but I'm not doing something right...

See .find()

Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

which traverses $data descendants for #testdiv , where $data appear to be #testdiv element itself ?

Try

$data.append('<p>Some Text</p>');console.log($data.is("#testdiv"))

Perhaps double wrap the testdiv finding query:

$.get( "returnAjax", function( data ) {
    var $data = $(data);
    $($data.find('#testdiv')).append('<p>Some Text</p>');
    console.log($data);
});