Is it possible to load an html document using ajax and then perform a jquery selection on the loaded html?
I want to perform a search against a remote search server and then use the results to reformat an existing page.
EDIT: the find function doesnt seem to return results (length is always 0). Here is the sample html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<p>Hello world</p>
<p>good bye world</p>
</body>
</html>
And here is the jQuery:
$(document).ready(function() {
$.ajax({
url: 'content/HTMLPage.htm',
dataType: 'html',
success: function(data) {
alert($(data).find('p').length);
}
});
});