[Javascript] DOM vs AJAX
David Dorward
david at dorward.me.uk
Wed Jun 21 03:33:48 CDT 2006
On Wed, Jun 21, 2006 at 09:02:37AM +0200, Michael Borchers wrote:
> 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 / ... .
Umm. The choice of server side language has no impact whatsoever on
what technologies are available client side.
> 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:) )
3. The link could load the content into an iframe
4. The link could call XMLHttpRequest to get some data which it then
uses to build a DOM tree with create element et al.
5. etc etc etc
> i see the advantage in solution 2 because it's pretty easy to change the
> table
Once you have your functions for building a table, its also easy to
change the data that goes into building it. You don't need to (and
probably shouldn't) define every createElement/appendChild manually -
write a function to walk a data structure.
>, its layout whatever.
and that data structure could easily include information about what
classes to apply to what elements.
--
David Dorward http://dorward.me.uk
More information about the Javascript
mailing list