I'm trying to display and extract a string from another page. The page in question will be a ftp:// HTML page. I've tried a few different methods and have been reading several similar posts that don't answer my question.
The page I'm requesting will only have one line, which is the line I need.
For example when Home.html is the main page. Then when returned.html is the page I am requesting, and it simply contains true or false.
My code
<script type="text/javascript">
var HTML = function ( address, callback )
{
if ( !window.XMLHttpRequest ) return;
var xhr = new XMLHttpRequest();
xhr.onload = function() {
if ( callback && typeof( callback ) === 'function' ) {
callback( this.responseXML );
}
}
xhr.open( 'GET', address );
xhr.responseType = 'document';
xhr.send();
};
function GetResponse()
{
getHTML ('ftp://192.168.2.5/1.html', function (response) {
var docele = document.querySelector('divNext');
docele.innerHTML = response.documentElement.innerHTML;
});
}
</script>
<style>
div.hidden {
display:none;
}
div.visible {
display:visible;
}
</style>
In this I'm trying to load the page into a div, but I'm also needing that into a variable to define other things later on.