"div/p" is supposed to get paragraphs that are children of divs. It's XPath syntax, which jQuery no longer supports.

Try
        var dom = $('div > p', data);
or
        var dom = $(data).find('div > p');
instead.

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Apr 4, 2009, at 10:33 AM, MorningZ wrote:


"dom is always null "

What the heck is the selector  "div/p"  supposed to get?

On Apr 4, 5:40 am, Albert <zinki...@gmail.com> wrote:
$(document).ready(function() {

        $.ajax({url: '/page/test.html',
            type: 'GET',
            dataType: 'html',
            timeout: 5000,
            error: function(){
                                alert('error');
            },
            success: function(data){

            var dom = $("div/p",data);
                                $('#parse_result').append(dom);
            }
    });

});

// test HTML
<div>
    <p><a>test dom tree</a></p>
</div>

I just can't get the code work because dom is always null
actual html is more complex, I just want to use the xpath to navigate
through the getted html
of course this is perhaps not the best way to do this

if you know a powerful way( I mean have xpath navigate ability) to
parse html pages at server side please do let me know, thanks very
much

Reply via email to