+ Reply to Thread
Results 1 to 2 of 2

Thread: Load Text file

  1. #1

    Load Text file

    I`d like to load a text file and display the content of it , i actually do not know what method should i use
    either Jquery or JS.

  2. #2
    Junior Member
    Join Date
    Feb 2012
    Posts
    14
    You can do it in both.

    JavaScript : using XMLHttpRequest to server
    Code:
    var client = new XMLHttpRequest();
    client.open('GET', '/foo.txt');
    client.onreadystatechange = function() {
      alert(client.responseText); // display content
    }
    client.send();
    Jquery :
    Code:
    jQuery.get('http://localhost/foo.txt', function(displaycontent) {
        alert(displaycontent);
    });

+ Reply to Thread

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