Is there a way to read plain text on server and store it on string variable ?
Printable View
Is there a way to read plain text on server and store it on string variable ?
Meaning read a text file in a seperate request and then use it? Yes - look at AJAX (you may want to visit the AJAX forum though it's still pretty new...)
Isn't AJAX is only read/write xml file with javascript ?
I want just plain text to be read
Then you will have to use a server-side language such as PHP or ASP.Quote:
Originally Posted by Jackyquah
I wouldn't ask in Javascript Forum. if I want to used other languages.
The Idea is the plain text contain part of html code like
<table>
...
</table>
so when using javascript I can insert to the current HTML page
Logical code :
var String=GetPlainTextString(UrlFilename)
[element].innerHTML=String
I don't want to used IFrame cause I must specify width and height and still it's using scroll bar if the content is larger.
I want it's fully show( as large as the content ) without using scrollbar.
Cool down.
You cannot read a file with just JavaScript. You'd have to use other technologies (AJAX) or other languages (PHP, ASP, etc). Both solution have been presented. To which forum would you like me to move this thread?
The reason I don't want used AJAX is because it's open in XML.
It will be pain to write in XML since HTML code is similiar to XML
i must using < > for < > and etc...
<xmldoccontent>
<table>
...
</table>
</xmldoccontent>
Google is your friend...
http://ajaxpatterns.org/Plain-Text_Message
Maybe the following trick will be good enough for you:
with html_inc.js containing:HTML Code:<html>
<head>
<script src="html_inc.js" type=text/javascript></script>
</head>
<body>
<h1>Test</h1>
<script language=javascript>
document.write(more_html)
</script>
</body>
</html>
HTML Code:var more_html = "<table>"
more_html += "<tr>"
more_html += "<td>foo</td><td>bar</td>"
more_html += "</tr>"
more_html += "</table>"