0

Hi I was hoping that maybe someone can help me out:

I created a bash script that connects to my free webhost via FTP and uploads a file.txt into the home directory. What I'm looking to do is to read this text and display it on my index.html site.

Looking around I seen the following script:

jQuery.get('path/to/file/on/server.txt', null, function(data, status) {
 // your file contents are in 'data'
});

how would I output 'data'?

Or is there any other method someone can recommend?

thank you.

orip
76k21 gold badges120 silver badges150 bronze badges
asked Dec 9, 2009 at 18:59

2 Answers 2

3
$.get("file.txt", function(data){
 alert("Data Loaded: " + data);
});

Edit: taken from the jQuery documentation

answered Dec 9, 2009 at 19:01
Sign up to request clarification or add additional context in comments.

Comments

1

Get the contents of file.txt and display inside a div with id "id":

$.get("file.txt", function(data){
 $("#id").text(data);
});
answered Dec 9, 2009 at 19:23

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.