That didn't work either Klaus ... I think the issues is "testHTML' is
actually the 'html' return of a .ajax call.  Still messing around with
all this, but heres the new code sample if anyone has any ideas:

     $.ajax({
                type:           "GET",
                url:            searchUrl,
                success:        function(html){
                        // I know this succeeds and is populated with
the correct HTML return data
                        console.log(html);

                        results = $( '.liTemplateLocation', html ).html();

                        // Doesn't output anything
                        console.log( "TEST::::" + results );
                }
        });

On Apr 21, 4:39 pm, Klaus Hartl <klaus.ha...@googlemail.com> wrote:
> Try:
>
> $(".targetMe", $(testHTML)).html();
>
> or:
>
> $(testHTML).find('.targetMe').html();
>
> You might get into trouble with that and the html and body tags, not
> sure. In that case you had to create your own document fragment...
>
> --Klaus
>
> On 21 Apr., 03:28, default_user <ayapej...@gmail.com> wrote:
>
> > I'm trying to get jquery to parse some text in a variable as HTML, has
> > anyone tried this before and got it to work?  Can this even be done,
> > or do I have to parse as text?
>
> > <CODE>
>
> > testHTML = "<html><head></head><body><ul><li class='targetMe'>TESTING</
> > li></ul></body></html>";
>
> > testGetHTML = $(".targetMe", testHTML).html();
>
> > alert( testGetHTML );
>
> > </CODE>

Reply via email to