Page 1 of 1

Simple AJAX XHTML Includes (like link/CSS or includes/PHP)

Posted: Sun May 13, 2007 11:43 pm
by JAB Creations
I'd like to use AJAX to do a live XHTML includes based off the ID of the anchor clicked.

For example on my preview site at http://www.jabcreations.net/ I'd like to do this with all the prompts (layers) in the personal toolbar (on the right sidebar). Minus the addition of the scripting itself it would allow me to cut the page by at least 20KB at this point (though I am not done developing that part of the page and thus may potentially double in size).

All the anchors that open prompts each have their own ids so I figure it would be a matter of making some form of array to associate includes files per id. Since my page is very dynamic I am thinking it would be best if I left the divisible elements with their second ids (the divs that will have content written in to them via AJAX) on the page during the initial load so we don't have to figure out what line in the XHTML the code needs to be inserted.

So for example if you go to change your audio preferences the audio div would open and the AJAX script would detect that the anchor with the id of personalaudio was clicked and to execute the script...run through the array, fetch the XHTML includes file, and write the includes to the element with the id associated in the array.

Does this make sense?

Posted: Mon May 14, 2007 12:13 am
by JAB Creations
Actually found more or less what I wanted...
http://www.dynamicdrive.com/dynamicinde ... ontent.htm