I'm trying to parse through html and would to get all <h3>...</h3> next to <table>...</table>, but have only gotten the first <h3></h3><table></table> from $('h3 + table', thecontents). Also, what if we wanted the h3 based on it's contents (ie. Friday, Dec. 14, Saturday, Dec. 15, ...)?
$( document ).ready(function() {
$.getJSON('http://www.whateverorigin.org/get?url=' + encodeURIComponent('...') + '&callback=?', function(data){
var thecontents = data.contents;
var required = $('h3 + table', thecontents).html();
$("#hello").html("<pre>" + required + "</pre>");
});
});
The contents of thecontents or data.contents is
<html>
...
<h3><strong>Friday, Dec. 14</strong></h3>
<table>...</table>
...
<h3>...</h3>
<table>...</table>
</html>
My current website returns required or $('h3 + table', thecontents).html()
<html>
<body id="hello">
<pre>
<p></p>
...
<p></p>
</pre>
</body>
</html>
