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. [...]


 




  • muscle relaxant
  • sr a karmienie piersiA
  • are and the same thing
  • 250 mg tablets
  • difference between and
  • quickly should work
  • average time it takes to get pregnant on
  • canadian pharmacy online
  • 20 mg tabletas
  • birth control pills
  • hypotension
  • causing yeast infection
  • patch 13 3
  • 120 mg kullanAcA yorumlarA
  • in postmenopausal women
  • e dolori al seno
  • can give baby
  • srbija cena
  • mixing valium
  • vitamin deficiency
  • inr
  • y lactancia
  • xr ndc
  • ingredients
  • missed three doses
  • side effects
  • cream coupon
  • for low tsh levels
  • used iud insertion
  • leva pak directions
  • 5mg dose
  • is used for arthritis
  • gel
  • angle closure glaucoma
  • purchase cheap
  • does cause high blood pressure
  • e diferenAa
  • xl monographie
  • extra stark
  • high blood sugar
  • dangers drinking while
  • high levels
  • xl 500mg antibiotic
  • acne treatment
  • for children side effects
  • ou qual o melhor
  • going generic
  • together
  • drinking alcohol while taking
  • does compared
  • use basal cell
  • vivid dreams
  • withdrawal side effects
  • ds safety pregnancy
  • spotting before period
  • trial program
  • lawsuits
  • cena przewlekAe
  • 40 pills 99
  • for non asthmatics
  • us fda approves new indication
  • successful withdrawal
  • health risks
  • overdosering
  • why no walnuts with
  • y consumo de alcohol
  • st john's wort
  • quit taking cold turkey
  • used to treat yeast infection
  • thin lining of uterus
  • alcohol 24 hours after taking
  • dose phn
  • 5 off printable coupon
  • and ritalin interactions
  • and phentermine taken together
  • and health risks
  • what is a high dose of
  • bella salon
  • can help hair loss
  • can increase blood pressure
  • voucher
  • 320 mg tablet nov
  • tylenol and together for pain
  • how does cause weight gain
  • can cause hot flashes
  • will cause me fail drug test
  • hcg injection after
  • versus
  • 25mg dichlorhydrate
  • online
  • fda indications
  • interactions
  • throat irritation
  • is a corticosteroid
  • vs vs alcohol
  • bronchitis antibiotics
  • medco genetic testing
  • sequels side effects
  • fA?r babys
  • blood pressure control
  • medication
  • while breastfeeding
  • negative ovulation test after
  • overdose
  • suspension package insert
  • how many times can i take my inhaler
  • interesting facts
  • 75 mg po bid
  • bula xro 300mg
  • cheap australia
  • effect blood sugar
  • generic india
  • for fatigue
  • vs.
  • ulotka dawkowanie
  • is bad
  • safe to take and benadryl together
  • recreational drug
  • going from to
  • o cual es mejor
  • side effects of 100 mg
  • withdrawal lawsuit
  • launch date
  • and hct
  • treatment allergic rhinitis
  • tablets
  • buy 5 mg
  • first week
  • allergic reaction symptoms
  • cost comparison
  • works immediately
  • natural foods for women
  • taking 60 mg
  • lawsuit update
  • 600 mg ne ilacA
  • legs
  • e pantorc
  • and liver damage
  • 7 month old baby
  • long should you take after pulmonary embolism
  • que es mejor o o
  • lilly canada
  • settlement canada
  • oral loading dose of
  • muscle pain
  • granulado 2.5 mg
  • vs
  • para 3 semanas de embarazo
  • symptoms not enough after thyroidectomy
  • can take atripla
  • history horses
  • build tolerance
  • does treat kidney infection
  • sospensione orale bambini dosaggio
  • non responder test
  • drug classification
  • plaquenil vs.
  • dose for bipolar disorder
  • 3 year old
  • cycle
  • brain shivers
  • side effects alcohol
  • interactions
  • and rebound headaches
  • herxheimer reaction
  • coupon code
  • fit 1
  • online sales
  • max dosage
  • is co-amoxiclav safe for pregnant women
  • pain pills
  • diarrhea side effects
  • quanto tempo dura o efeito do
  • doses
  • bristol-myers squibb patient assistance foundation
  • side effects children migraines
  • or
  • can you take allegra d
  • long term weight gain
  • 250mg 125mg
  • keramag plan stand wc
  • withdrawal stomach cramps
  • does increase serotonin
  • adriamycin inflammatory breast cancer
  • water retention men
  • blood test result
  • how much does cost at walmart
  • free astrazeneca
  • can you take dexilant together
  • arimedex hd vs
  • proviron
  • x lei
  • is available as a generic
  • 800 with alcohol
  • dental
  • rapid 50 mg alkoholi
  • interaction between grapefruit juice
  • how long works
  • taking during pregnancy
  • fast website
  • patient education
  • 4 mg 90 tablet
  • research chemicals
  • en zwanger
  • cream efficacy
  • cost without insurance
  • sebaceous cysts
  • long does stay your urine system
  • cheapest place buy
  • when will be generic
  • generic photo
  • can you get high 7.5
  • add
  • inactive ingredients
  • taking
  • derma 1 krAm A?r
  • how long does take to cure bronchitis
  • prescription card
  • dangers stopping cold turkey
  • que es la pastilla
  • for cholesterol
  • can take nurofen
  • salbe fA?r kinder
  • erectile dysfunction
  • price uk
  • drug interaction between
  • telma h
  • while on a cycle
  • and acid reflux
  • does cause weight loss
  • prescription medicine
  • sa 100mg capsules
  • & hcg shot success stories
  • newborns
  • yan etki
  • vs
  • y ginecomastia
  • buy online without rx
  • is safer than aleve
  • can you take
  • bruising
  • take blue pill
  • can you overdose on
  • v s
  • tablets indian price
  • buy philippines
  • fairless hills
  • england football team
  • 5mg or 1mg which is better
  • bad your bones
  • resistance ppt
  • can you get high
  • hiv drugs
  • can cause vertigo
  • for major depression
  • bone pain vitamin d
  • what is 4 mg
  • do you gain weight
  • type 1 diabetes
  • birth control reviews side effects
  • vs cost
  • cream for inflammation
  • palm desert
  • bristol-myers squibb patient assistance foundation
  • for fibromyalgia
  • picture
  • does cause leg pain
  • and insomnia in infants
  • pancreatitis
  • xl tylenol
  • is a calcium supplement
  • burning urination
  • taking and together
  • can you take d with mucinex dm
  • antibiotic bronchitis
  • can taken together
  • head tremors
  • itching scalp
  • for weight loss
  • vs
  • liver failure
  • and xanax combination
  • bridging surgery
  • use teenagers
  • famine ocd
  • what do fake pills look like
  • heparin together
  • abdominal cramps
  • aetna insurance cover
  • retin a or better
  • long good after expiration date
  • and drug interactions
  • use alzheimer's
  • is dangerous
  • antibiotic information
  • side effects nih
  • can drink alcohol
  • effects of on men video
  • medication
  • online
  • la 4 luni
  • dosage for thrush in adults
  • level correction calculator
  • monographie de xr
  • now review
  • vs. for ocd
  • tardive dyskinesia infants
  • australia
  • can u take and together
  • skin rash
  • combination side effects
  • 400 mg dosage
  • keramag nr.1 comprimo eckwaschtisch
  • generic medication
  • rash pictures
  • generic reviews
  • 15 mg side effects
  • is a psychotropic
  • edta chelation
  • too much shortness of breath
  • neonatal dosing
  • y transaminasas
  • 25mg tablets
  • is aspirin free
  • tablets 10mg
  • purpose
  • or which is better
  • how long does it take a pill to work
  • taking and together
  • brain chemicals
  • and factor v leiden
  • pill identifier
  • seaweed
  • affect on blood pressure
  • interaction between and
  • mood swings men
  • merck braces flood lawsuits
  • pregnancy risk
  • stomach pain
  • hfa user reviews
  • onset
  • how long will last
  • user reviews
  • taking d with nyquil
  • comparison of
  • same family
  • as a standalone
  • penguat kandungan
  • schmerzgel anwendungsgebiete
  • effects on diabetes
  • how soon does work
  • emulgel bij zwangerschap
  • xl and breastfeeding
  • infertility male
  • e bula
  • aime t il a tomber enceinte
  • cause dizziness
  • should you take before blood test
  • ringworm while on
  • basal cell carcinoma treated with
  • ok take while pregnant
  • gout
  • ears ringing
  • prima o dopo pasti
  • albumin equation
  • side effects lower back pain
  • iv vial
  • does damage your liver
  • day 82
  • generic cost
  • copay discount card
  • low testosterone treatment
  • and combination
  • e penicilina
  • funciona mesmo
  • long does take start working
  • abruptly discontinuing
  • t lotion ingredients
  • sleeping pill
  • heart arrhythmia
  • price canada
  • can you take advil while taking
  • does xr show up drug tests
  • prozac wean off
  • how long does affect birth control pills
  • shampoo buy australia
  • allergic reaction
  • bulas de medicamentos
  • shortage
  • gsk uk
  • buying cheapest generic soft tab
  • patch parkinson's disease
  • quanto custa o
  • can't swallow
  • buy no prescription
  • taking and
  • odt orange ndc
  • gtt
  • constipation
  • website philippines