Problem using GXmlHttp

N

new_dude

Hi everyone,

I am trying to get and print out a file content using JavaScript
GXmlHttp, but nothing gets printed out. The following is the complete
HTML source code containing JavaScript. Any help is greatly
appreciated.


<html>
<head>
<title>Display the file contents</title>
</head>
<body>
<script language = "JavaScript">
<!--
function displayFileContent(filePath)
{
var request = GXmlHttp.create();
request.open("GET", filePath, true);
request.onreadystatechange = alert(request.readyState);

request.onreadystatechange = function() {
if (request.readyState == 4) {
alert(request.responseText);
}
}
request.send(null);
}

//alert("hello");

displayFileContent("test.txt");

-->
</script>
</body>
</html>
 
T

Tom Cole

Hi everyone,

I am trying to get and print out a file content using JavaScript
GXmlHttp, but nothing gets printed out. The following is the complete
HTML source code containing JavaScript. Any help is greatly
appreciated.

<html>
<head>
<title>Display the file contents</title>
</head>
<body>
<script language = "JavaScript">
<!--
function displayFileContent(filePath)
{
var request = GXmlHttp.create();
request.open("GET", filePath, true);
request.onreadystatechange = alert(request.readyState);

request.onreadystatechange = function() {
if (request.readyState == 4) {
alert(request.responseText);
}
}
request.send(null);

}

//alert("hello");

displayFileContent("test.txt");

-->
</script>
</body>
</html>

You may want to consider importing the Google code that actually
defines what a GXmlHttp is... If this is your complete page, how are
you not getting errors? I get GXmlHttp is not defined...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top