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>
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>