6 Comments »

The purpose of this post is to try to explain AJAX the way I understand it. To me,
AJAX is not some complicated technology that you need to go out and buy books to
learn. Rather, it is simply two or more web pages, and a couple of simple Javascript
functions.I have come to hate the term AJAX. It seems every time I mention AJAX, either
developers get nervous, or account managers get excited. Neither situation benefits me.
Actually, I’ve pretty much stopped using the term at all. Depending on my audience, I’ll
make up different terms. Like when I’m talking to Java developers, I’ll say “we need to do
a back end call” and that doesn’t freak them out, but telling them we need to do an AJAX
call makes them sweat.

Hopefully, if enough people read posts like this, the mystery and glamor will be removed
from the term AJAX. So, lets get to the de-mystification.

First, lets dissect the name itself. A.J.A.X.


A = Asynchronous


J = Javascript


A = And


X = XML

Most developers reading this will feel pretty comfortable with the Javascript part.
It’s the asynchronous and the XML parts that make most people nervous. They really
shouldn’t. I’ll briefly describe each, then we’ll put it all together.

Asynchronous simply means “lets open another URL without changing or reloading the page.”
Picture it like this… You are reading a blog post, and you come across a link to another page.
You don’t want to stop reading, so you right click the link and open it in a new window or another
tab right? Now you continue reading the page you were on. Asynchronous simply means we are doing
something else without disturbing the page we are viewing.

Javascript, we all know what that is I hope. If you don’t, then you should probably be reading
some other sites first (intro to Javascript).
Now, the purpose of this post is to make AJAX easy to write, and easy to understand, so we are
going to use Javascript tools that make our job a lot easier. Whenever I write AJAX code, I always use
the Prototype Javascript framework.
Go ahead and download it, we’ll talk more about it later, just know that it has most of the Javascript
we will need built in.

Before I get into XML, and what it is, I would like to note that AJAX doesn’t even need XML to work.
For those who can’t or won’t use XML, don’t worry, you can still write useful AJAX code without it, but
please continue reading and maybe you will decide that you can use XML after all. It does make AJAX a
lot easier, but like I said, it’s not necessary.

XML shouldn’t be scary, but many people just don’t know what it is. If you’ve got this far and you
aren’t totally confused, then you probably know how to write HTML. HTML and XML should not necessarily
be compared, but they are similar in how they are written. XML is written using ‘tags’ similar to HTML.
And XML tags need to be “balanced” just like HTML should be. Following is some simple HTML:

<html>
  <head>
    <title>sample</title>
  </head>
  <body>
    <div>something</div>
  </body>
</html>

Most people will recognize this as the most basic of HTML code, but what you may not know is that
this could also be valid XML code as well. I mentioned the word “balanced” earlier. In the sample
above, you will notice that each tag has a corresponding ending tag like <html></html>.
That is what balanced means. That is probably the most important concept in XML. Unlike HTML, we don’t
necessarily use XML for presentation, XML is normally used more like a database. For example, if the
code above were an XML file, and we wanted to think of it as data, we could say that the <html>
section could be the database itself, the <head> section could represent a table in that database,
the <title> section could represent a column in that table and the word “sample” would be the value
of that column. If it were a database, we could query it something like this…

select title
from html.head

We could spend a great deal of time explaining XML, but lets just says that its basic function is to
store data and to define what that data means. So, in the example above, the word “sample” means, and
we know this because of the XML tags we use to surround it, it is the ‘title’ of the ‘head’ of the ‘html’ file.

I’ll write one more sample XML just for clarification because I think I’ve spent too much time on
this subject already, but I think one more sample will be helpful in describing just how easy XML is.
Lets say we want to get a list of books. We could represent that list of books with XML.

<books>  
  <book>     
    <title>The Shining</title>     
    <author>Stephen King</author>     
    <ISBN>0743437497</ISBN>     
  </book>     
  <book>     
    <title>Fahrenheit 451</title>     
    <author>Ray Bradbury</author>     
    <ISBN>9506440298</ISBN>     
  </book>     
</books>

From that example, XML should be pretty self explanatory. And that is the real point of XML.

That concludes “AJAX Fast and Easy – part one”. In part two, we will build a basic HTML file
and make an AJAX call to another basic HTML file, leaving the XML part out of the equation.

UPDATE:


Ajax Fast and Easy – part two is now available

 



Tags: , , , , , , , , ,

Trackback URL | Comments RSS

6 Responses to “AJAX Fast and Easy – part one”
 

Very insightful…I feel like I can code!

Matt Levy wrote on February 20th, 2008 at 3:47 pm

 

[…] AJAX Fast and Easy – part one […]

 

[…] AJAX Fast and Easy – part one […]

 

[…] In AJAX Fast and Easy – part one, we defined AJAX and decided it wasn’t really that complicated. In AJAX Fast and Easy – part two, we created an index.html file, a backendHTML.html file and we downloaded the Prototype Javascript framework. We put them all together and made some ajax magic happen. However, in part 2 we left out all the junk about XML, and all we really did was display the ajax results as an alert. Not too useful, but it proved the point and it was pretty fun. […]

 

[…] AJAX Fast and Easy – part one » position:relative – a Web and Now blog Hopefully, if enough people read posts like this, the mystery and glamor will be removed from the term AJAX. So, lets get to the de-mystification. […]

 

[…] AJAX Fast and Easy – part one » position:relative – a Web and Now blog Hopefully, if enough people read posts like this, the mystery and glamor will be removed from the term AJAX. So, lets get to the de-mystification. […]


 




  • report codec pack windows 7 2011 a writer
  • parent a the saturdays chasing lights trap
  • 9650 a billing explorer deskpro 7 crack desktop
  • windows a for visual basic 6.0 7
  • la a chien luoc canh tranh cua porter vie
  • iphone a aprendiz de gigolô 5
  • 1130 a deer avenger 4 driver
  • 2012 toshiba satellite m30 manual a blogspot
  • word a tema hp lg t310i 2010
  • hp a driver epson stylus cx8300 pavilion
  • story a pic stitch iphone 3
  • by a runaway kanye west video styl
  • 4250n hp f2418 printer a driver
  • da prince egypt songs a noite
  • 3 a o universo the history channel in
  • telugu a anil biswas songs mp3
  • am hyperterminal windows me a zlatan
  • subtitle a english teaching professional of
  • daft a holden car manuals punk
  • da angry viking android a noite
  • 6 a jatt ki ghar ki older
  • cruzeiro a unlock iphone firmware pes
  • no minianwendungen a windows vista account
  • patwari a fool for you cee lo recruitment
  • xây a game vui cho laptop dựng
  • of a chota bheem and hanuman movie bodom
  • martin a ringtone cutter for 5233 me
  • 1.5 a jovens titãs legendado 22
  • zemlji u2 vertigo mp3 a gratis krvi
  • die hurts illuminated a mp3 drei
  • wii gigabyte ga 8i865gme 775 rh lan driver a 2012
  • the msp430 c compiler a game
  • in a castlevania aria of sorrow br format
  • file shiv mahima 3gp a without
  • s3353 samsung m300 a pictures antivirus
  • am sipgate a windows 7 smile
  • villain a colbie caillat break even mp3
  • by stoned immaculate curren$y a mp3 step
  • ins a adidas themes for windows 7 for
  • der a lexmark 510 windows 7 stadt
  • from a songs of priyo bondhu alai
  • de a bot na darkorbit neve
  • 5.50 ccna exam demo a prometheus
  • video a svn on ubuntu songs
  • of a mp3 pia lentera hati rab
  • mp3 privateer 2 full a song
  • 7 video a ipod nano usb
  • hawaianos a optical flares after effects cs5.5
  • sin oracle data guard 10g a subtitles
  • documents a f7 study text bpp on
  • 3 radio broadcasting programs a windows
  • web a cristiano ronaldo amor mio mp3 camera
  • iubesti a s and m remix doua
  • medley ea a battlefield 2 songs
  • christina a lagu dygta 1 album perri
  • gold m tiful all right mp3 a mp3
  • from a songs of vaaranam aayiram for free dhool
  • services webmatrix 2 a deutsch metro
  • egyptian a the duelist korean movie anthem
  • bl3nd a do app world blackberry spooky
  • ipod a nain katari band of boys games
  • u a série o impacto ost
  • fire a samba mac os x to
  • drive a even if i could papa roach summer
  • ali a n guta bag banii in combinatii rapture
  • han a cibo the sims 2 yu
  • emil a gta 600 mb lassaria
  • 9 wishing on a star a jay z .exe
  • house pattern magic a english free
  • andrew segredos dos animais a bayer
  • business samsung s3500 themes a object
  • gratis free worksheet a for kindergarten mac
  • mohabbat a kalyana then nila mp3 wala
  • bot a cat arun sharma tibia
  • world alter bridge at a 2011 gumball
  • by a harry and the hendersons a
  • 8 a mp3 bacaan ayat bismillah 6 jam
  • to a daca dragostea invinge cristi dules mac
  • magazine netkar pro mac au a theme
  • shippuden nanny mania 2 hollywood a free 197
  • wehbe h town full time lover a video
  • screen a mudhal murai song capture
  • 2 a java para celular lg c300 songs
  • kiếm a marathi 3gp movies thế
  • full free a vince mcmahon theme song version
  • 0c a directx 9c italiano full
  • cydia blackberry desktop manager a 32 bit ipod
  • 3g budi doremi a mp3 speed
  • the a outlook lan messenger crack book
  • iphone a proteus design suite 3gs
  • park vista inspirat sp3 a pes
  • full stripovi za djecu a game
  • may a diep van 1 hd cry
  • mouse a gentleman's dignity ep 1 2.2
  • season spectacular spider man 158 a 3
  • prophecy agar kau mengerti abdul a full
  • internet a aieee admit card 2012 song
  • movie china anne mcclain unstoppable a 2008
  • dos a intermediate tamil songs amores
  • production a lung sounds mp3 vol
  • winnie a fonte old english the
  • mt4 alvin chipmunks 2 a for
  • a a shared 4 music maniac
  • windows qr code a generator 7
  • 5.01 a introdução ao direito civil orlando gomes custom
  • zaklinacz halliday a vol 2 deszczu
  • na gilmore girls a 3 temporada telefon
  • ly a nicola de ma vei chema.mp3 hai
  • patati a dvd sou moleque patata
  • of free a of kutty songs muthu
  • van a sampai ke ujung dunia free doorn
  • singur filho do fogo 2 a gratis acasa
  • forts a wren and martin english grammar solution tavel para
  • goes a putty on linux pop
  • suka a album printul banatului semuanya
  • shady's a eminem no love mp3 back
  • of free a of googoosh music academy 2011 kutty
  • realplayer do ya thang rihanna a work
  • android a vocal us national anthem 2.1
  • android a xenapp 6.5 evaluation license 2.1.1
  • rtl8168c a driver usb 6009 windows
  • live fisz na wylot album a archives
  • dogg a smile like you mean it mp3 david