Question: I have HTML in a string returned by an ajax call. I would like to get the value of an element like I would with a normal selector: `$('#my_div')`, not by regex.

Unfortunately I don't know how to do this since it's in a string...

Can anyone help?

Answer: 
Will do it like that : 

```
$(document).ready(function() {
    $.ajax({
        type: "POST",
        url: '/echo/html/',
        dataType: "html",
        data: {
            html: "<span id='foo'>test</span><br/><span>Test2</span>",
            delay: 1
        },
        success: function(data, textStatus, jqXHR) {
            $('#result').append($(data));

            // use $("#result selector") here, for example:
            alert($("#result #foo").text());
        }
    });
});

```

with a `div#result` in the HTML doc

see <http://jsfiddle.net/Regisc/tzHsb/1/>

Be aware that evaluating the string from the ajax call can be dangerous because there can be a script in the response.
Took me a while to figure this out, but I had to add a wrapper to my html to get this to work, otherwise jQuery returns an array of elements, and looks inside each. 

This worked for me:

```
jQuery("<div>" + response.responseText + "</div>").find('#response_code').html()

```