I send to a php page a request and the output is like that
<?php
echo "<div id=\"someid\">
innerHTML
</div>"
?>
I try to catch the element but it doesnt work
var a=document.getElementById('someid');
alert(a.innerHTML);//alert nothing
How do I fix it with pure javascript?
If you are getting the content of a PHP page with AJAX (not
includeing it), you have to append it to the DOM somewhere.Are you appending it to the DOM in your code?
If you are using
include,require, etc. then that is not AJAX.You would have to wait until the page is loaded, so the code would go something like this: