Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
03-02-2007, 03:33 PM #1
A beginner's luck with Ajax: including one file text in another
I am posting this thread to encourage those who have not used Ajax before. It is much easier than I thought it would be.
I have many lines at the begining and the end of all my pages that are constant. The obvious solution is to use a Server-Side Include for these. However, the VLE I am using (WebCT Vista) will not permit these.
Having read the article on 'How do I include one HTML file in another' at Boutell.com, I though that Ajax would do it better, and indeed it has.
- Include this function in my preliminary javasacript file;
- Add two calls to this function in my onload function;
- Insert two named DIVs, one at the top and one at the bottom.
It worked like a dream.
In the onload function I have the lines:
and in the file I have
<div id="TopLines"><div> at the top, and
<div id="BottomLines"><div> at the bottom.
This has the great advantage that I can edit these included files without Dreamweaver telling me I cannot change the template!
12-07-2007, 10:17 AM #2
- Join Date
- Dec 2007
- Thanked 0 Times in 0 Posts
It didn't worked for me.
I don't use external .js file for "clientSideInclude". I simply out row in the file inside <script> tag.
Then I used the function
to insert more than one includes.
I put the function here
<body onLoad= "Doit();">
..and the appropriate <div> in my file to get the includes but i get the first one ALWAYS!
Thanks in advance.
12-13-2007, 11:17 AM #3
- Join Date
- Jun 2007
- Thanked 600 Times in 580 Posts