[Javascript] DOM vs AJAX

Michael Borchers list at tridemail.de
Wed Jun 21 02:02:37 CDT 2006


> On 6/20/06, Mike Dougherty <mdougherty at pbp.com> wrote:
>> Obviously there are correct uses for AJAX.  It allows cool things to be 
>> done in a browser that
>> were simply not possible before.  None of the HowTo I have seen about 
>> AJAX discuss when NOT to use
>> it.
>
> There's a pretty good treatment of when not to use AJAX in this book,
> chapter 11:
>
> http://www.amazon.com/gp/product/076459723X/

indeed i work with php. so regarding adding content when working with mysql
and other php solutions there is no other way than AJAX / web 2.0 / ... .

to bring it back to the basic idea of my post:

index.htm f.e.:
<a href="...">add content</a>
<div id="newContent"></div>

let's say the new content will be a <table>.
1. the link now could call a javascript function that creates this table by 
createElement(...) (what i like to call DOM:) )
2. the link could call a XMLHttpRequest, which returns the table that has 
been stored in a seperate file (what i call AJAX:) )

i see the advantage in solution 2 because it's pretty easy to change the 
table, its layout whatever.
you could even use a normal HTML editor to do that, but if you aren't that 
familiar with DOM,
it would take me some time with the function.

now which one do you prefer and what are the actual (dis-)advantages?!

sorry, this is the way my first post was supposed to look like i guess;)
(kind of hard writing english in the morning here in germany;) 




More information about the Javascript mailing list