I am trying to read in a html file, and then only display certain parts on the page.
I have currently read in the file using AJAX and the requestData.js file. I can then alert out the whole page using that html variable I have created and that works fine.
However it is then when I try and get all the <p>
Tags (or any other tag doesn't work), that it comes up with this error.
TypeError: 'undefined' is not a function (evaluating 'html.getElementsByTagName("div")')
What am I doing wrong here?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" language="JavaScript" src="requestData.js"></script>
<script type = "text/javascript">
function refresh(xmlhttp){
var html = xmlhttp.responseText;
var ps = html.getElementsByTagName("p");
}
</script>
</head>
<body>
</body>
<input type = "submit" onclick = "requestData('home.html', refresh)">
</html>