Results 1 to 4 of 4

Thread: Loading content of a text .txt file using jQuery

  1. #1
    Join Date
    Oct 2008
    Posts
    35

    Loading content of a text .txt file using jQuery

    Hello,

    I need to know the correct way for uploading the content of a text (.txt) file using jQuery. Any sample example would also help me. Can anyone point me in the right direction please?

    Thanks in advance.

  2. #2
    Join Date
    May 2008
    Posts
    37

    Re: Loading content of a text .txt file using jQuery

    Loading content dynamically with jQuery

    We will load content in 2 ways: locating each section in the same file (sections.html) and loading all the content from an external file (external.html).

    Code:
    <div id="section_home">  
         <h2>Home</h2>  
         <p>  
              <a href="">dummy</a> Here is some text.
         </p>  
         <p>  
              <a href="">typesetting industry</a>.  Here is some text.
         </p>  
     </div>  
       
     <div id="section_news">  
         <h2>News</h2>  
         <p>  
             We have released our forums, <a href="http://forums.yensdesign.com">check it out</a>!  
         </p>  
     </div>  
       
     <div id="section_interviews">  
         <h2>Interviews section</h2>  
         <p>  
             We have interviewed Victor Espigares, creator of <a href="http://www.visualizeus.com">visualizeus</a>!  
         </p>  
     </div>
    Here you have external.html:

    Code:
       1. <div id="section_external">  
       2. <h2>External content!</h2>  
       3. In this case we are loading the External section from other external file, instead of use jQuery selectors in the sections.html file.</div>

  3. #3
    Join Date
    May 2008
    Posts
    32

    Re: Loading content of a text .txt file using jQuery

    jQuery Load Content

    After completing this example you will be able to use jQuery to Load the content from server side text file and show it to the user.

    1. Web page is displayed with a button "Load Content" and a blank text box
    2. User clicks on the "Load Content" button.
    3. jQuery loads the context of a text file "testFile.txt" and displays in the text area.

    jQuery code in the page

    The following jQuery code retrieves the data from server and display in the text area.

    Code:
    function contentDisp()
    {
    $.ajax({
    url : "textContent.php",
    success : function (data) {
    $("#contentArea").html(data);
    }
    });
    }

  4. #4
    Join Date
    Oct 2008
    Posts
    35

    Re: Loading content of a text .txt file using jQuery

    Hey guys thanks for providing exactly what i needed & that too so fast.

    Thanks again.

Similar Threads

  1. How to display content of cell in a text box Excel 2003 VBA
    By !Jumala! in forum MS Office Support
    Replies: 2
    Last Post: 21-02-2012, 02:03 PM
  2. Need to use jQuery in content process of Mozilla Firefox
    By Gowravaram in forum Technology & Internet
    Replies: 5
    Last Post: 02-02-2012, 05:22 AM
  3. Replies: 10
    Last Post: 06-01-2012, 10:23 PM
  4. Facebook for android stopped loading content?
    By Roasted in forum Portable Devices
    Replies: 6
    Last Post: 03-06-2010, 10:02 AM
  5. ie press ok to continue loading the content on the page
    By Ashton5 in forum Windows Software
    Replies: 3
    Last Post: 09-06-2009, 07:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,641,926.14220 seconds with 16 queries