PDA

View Full Version : form that displays a .txt file


ns74
03-03-2009, 11:03 AM
Hi, I am an italian boy, so I apologize for my english.

I have this problem:
I want to do a html page with a form that display some text that is in a file .txt.
So when I want to change the text displaied in the form, I can change the test in the file .txt.

It is possible to make this in javascript or I have to ask to another forum or another application?
(I wouldn't use a asp page)

Thank in advance...e sorry for my english.

SiNi

Spudhead
03-03-2009, 11:40 AM
You can do this with AJAX. Here's how you could do it using the jQuery (http://jquery.com/)library, for example:



// when the page is ready
$(document).ready(function(){

// fetch the text file
$.get("myTextFile.txt", function(data){

// when the text file is loaded, put its content into an element on the page.
$('#myFormElement').text(data);

});

});



You'll need to include the jQuery JS file (http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js) on your page.

ns74
03-03-2009, 02:17 PM
I thank you very much.

Could I ask you a favour?
Could you make me an example with a form?
I am new in html pages and I have not a great experience...

I Thank you in advance.

SiNi