Include text.txt file content in main.html page

I have 2 files.

c:\main.html
c:\text.txt

How can I include the text from the text file text.txt in my Main.html page ?

Thank you,,,,

LVL 1
New_AlexAsked:
Who is Participating?
 
aladin404Commented:
0
 
jkofteCommented:
you can use activex object or xmlhttprequest (AJAX). You need to use javascript in both conditions.
check this link: http://social.msdn.microsoft.com/Forums/en-US/sidebargadfetdevelopment/thread/64ea2d16-7594-400b-8b25-8b3b9a078eab
0
 
Kiran SonawaneProject LeadCommented:
You can do like this
Here is code for main.html


<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<script>
  $(document).ready(function(){
    $.get('text.txt', function(data) {
            var lines = data.split("\n");
            $.each(lines, function(n, elem) {
                $('#myContainer').append('<div>' + elem + '</div>');
            });
        });
   
  });
  
</script>
<body>
  <div id="myContainer"></div>
</html>

Open in new window

0
 
carlmdCommented:
You can it it by including the following, formatting as you need

<td>
<object width="625" height="300" type="text/plain" data="http://www.myufd.com/message.txt" border="0" >
</object>
</td>
0
 
New_AlexAuthor Commented:
Thank you sir
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.