I currently download an HTML from a website and I'm using "responseText" to get the HTML code, now I only want a specific part of it. How do you select a specific part of the HTML code with XMLHttpRequest? I already research doing it using Xpath or querySelectorAll, how do I do this practically and easily? Let say from the HTML code you wan't to select only --> div where id="home-members".
Thanks in advance!
This is the codes:
foobar.com/index.html:
..........
.....
<body>
..........
<div id="home-members">
........
.....
</div>
....
</body>
My Traversal code:
<script>
$.ajax({
url: "http://foobar.com/index.php",
cache: false
}).done(function( html ) {
var partial = $(html).find("home-members");
$("#results").append( partial);
})
</script>
<body>
<div id="results"></div>
</body>
I recommend use HtmlAgilityPack for this.