Problems parsing HTML from $.get()
Am I misusing $.get() somehow? I have a very small javascript function that calls $.get() for a URL on my site, but jQuery doesn't seem to see the HTML properly. The javascript looks like this:
-
function() {
$.get('http://www.clubtroll.com/debug/sample2.html',
{},
function(html) {
alert('div count = ' + $('div', html).length);
alert('content area: ' + $('#contentArea', html).length);
alert('sub content area: ' + $('#subcontentArea', html).length);
},
'html'
);
return false;
}
The HTML looks like this:
-
...
<body>
<div id="contentArea">
<div id="subcontentArea">
<p>This is the content</p>
</div>
</div>
</body>
The jQuery sees only the inner div. You can see this all in action
here. What am I doing wrong?