January 6, 2009 at 07:06 pm - by error404 (2 Posts) | |
|---|---|
Does anyone know ajax or a good place to learn ajax other than w3 schools. I need to get text files to load into a section of my website called "colTwo". Or html files. There is going to be at least 5 of these pages or text files if that makes a difference. | |
September 21, 2009 at 10:23 am - by Boltgog (1 Posts) | |
|---|---|
If you know PHP and JavaScript, then it shouldn't be too hard to learn AJAX. I would suggest either getting a copy of Building a Website with Ajax by Larry Ullman (I bought it and it has tought me quite a bit). | |
April 27, 2009 at 08:27 pm - by Pancake (6 Posts) | |
|---|---|
If you're including a file from PHP, it's probably best that you use: echo file_get_contents("file.txt"); simply because using include() executes the contents of the file. | |
April 19, 2009 at 01:26 pm - by Cypy (4 Posts) | |
|---|---|
As Broopet and Coder already mentioned, you do not need Ajax to load text files into your website. Ajax is a way to send http requests asynchronously, after your website has already been loaded by the user. If you simply want these text files to be loaded to "colTwo" as the page itself loads, use PHP. This is how it works:
| |
January 18, 2009 at 11:04 am - by broopet09 (6 Posts) | |
|---|---|
PHP is certainly an option, and potentially easier than AJAX, but it doesn't have the nice dynamic feel of the page populating before your eyes. I would check out jQuery or one of the other AJAX frameworks. I know that jQuery has something along the lines of Ajax.load() which will send off an xmlHttpRequest to get the page asynchronously (dynamically) and then put the results wherever you want them. jQuery has some pretty good tutorials if I recall correctly. -peter | |
January 9, 2009 at 10:30 am - by coder78 (1 Posts) | |
|---|---|
I would use php. There are plenty of php functions that will open text files and include them, or if they are html files, the include function will do it for you. | |

