Just what is "Ajax" ???

N

Noozer

OK, I'm at a loss here... I've spent some time on Google and Wikipedia and
still don't understand just what Ajax is...

Not sure if this is the best group to ask this in, but I really don't see
any others which are more relevant.

Just what is Ajax? Is it just a "way" to code a webpage? Is it a different
language, like VB.Net or Java?

Does anyone have any examples of what IS and what ISN'T Ajax? (Like a CSS
comparison of a table layout vs. a CSS layout)

....and as an aside (and barely related) question, how about XML? I though it
was just another markup language but I'm being told to stop using ASP and
start using XML for my database apps.

Any help is appreciated!
 
H

hywel.jenkins

Noozer said:
Just what is Ajax? Is it just a "way" to code a webpage?
No.


Is it a different language, like VB.Net or Java?
Possibly.


Does anyone have any examples of what IS

http://kibo.org.uk/ajax.php - just start typing in the "Find box".
It's early code, and doesn't work in Opera. I've tried it in IE6 and
Firefox 1.5 - that's it.

and what ISN'T Ajax?
http://kibo.org.uk/index.php


...and as an aside (and barely related) question, how about XML? I though it
was just another markup language but I'm being told to stop using ASP and
start using XML for my database apps.

That should be fun, epecially when you consider that XML is just a data
format. If someone's telling you to start using it instead of ASP,
ignore them.

Going back to Ajax, I don't think you need it.
 
D

Dylan Parry

Pondering the eternal question of "Hobnobs or Rich Tea?", Noozer finally
proclaimed:
I'm being told to stop using ASP and start using XML for my database apps.

Interesting. Who exactly is telling you to do this>
 
T

Toby Inkster

Noozer said:
Just what is Ajax? Is it just a "way" to code a webpage? Is it a different
language, like VB.Net or Java?

It is something that you can do by combining a few existing technologies:

- Javascript;
- A server-side scripting language; and
- XML

Here's a basic pseudo-code example of AJAX:

<html>
<script type="PSEUDO-CODE">
function ajaxFunc ()
{
a = document.getElementById("a").value;
b = document.getElementById("b").value;
xrt = new XML_Request_Thingy();
xrt.open("http://example.org/myscript.php?a=" + a + "&b=" + b);
c = xrt.response();
alert("The answer is " + c);
}
</script>
<form>
<input name="a" id="a"> +
<input name="b" id="b">
<input type="submit" onclick="ajaxFunc();" value="Add!">
</form>
</html>

and here is myscript.php:

<?php
$a = (int)$_GET['a'];
$b = (int)$_GET['b'];
$c = $a + $b;
header("Content-Type: text/xml");
print $c;
?>

Do you see what's happened?

1. Client-side Javascript has some information (in the
example, it has 'a' and 'b').
2. It passes the information to a PHP script via an HTTP
request.
3. The PHP script does something with it (in this case,
adds the two numbers together).
4. The PHP script prints out its reply.
5. The Javascript receives the answer.
6. The Javascript does something with the answer.

The techology is now there for all the main browsers: IE 5.5+ (perhaps
5.0?), Gecko 1.1+ (?), Opera 8.5+, Safari 1.mumble+ and so on.

The example I presented is trivial -- the Javascript could have easily
done the adding itself -- but there are some things that it makes a lot of
sense to pass to the server for processing. Database access is one obvious
application.
 
A

Andy Dingley

OK, I'm at a loss here... I've spent some time on Google and Wikipedia and
still don't understand just what Ajax is...

Your google fu is extremely weak then.

Read the excellent "Ajax in Action"
Just what is Ajax?

It's an enabling paradigm shift underlying the Web2.0 technology
platform, silly!
Is it just a "way" to code a webpage? Is it a different
language, like VB.Net or Java?

No, absolutely not. Ajax is something that has been done regularly
since 1999 or so, built by assembling existing tools. Then it was
rounded up, tidied up, had its nose wiped and a book or two written
about it.
Does anyone have any examples of what IS and what ISN'T Ajax? (Like a CSS
comparison of a table layout vs. a CSS layout)

Think of an interactive form-filling task on the web, with an address
fill-in.

Old style:

User requests page.
Server sends page. Page is very big.
User selects State. Can't select County
User clicks to send page.
Server returns page with county list added for that state.
User realises they'd selected the wrong state and has to do it again.
User gets bored.

Ajax style:

User requests page.
Server sends page. Page is small.
User selects State.
Page uses Ajax to load county list while the user is on the same page.
User selects county.
Page calculates shipping costs to that county, by querying the post
office's server and UPS's server, then offering the best deal to the
user.
(User still hasn't had to submit a page to the server and wait for its
return yet)


How it does it is that it breaks the old HTML dependence on HTTP, and a
single "get page, submit page, get page, submit page" sequence. Bits of
JavaScript code and a component that can retrieve data (usually in XML)
by doing HTTP from within the same page are used. These allow the page
to get or submit snippets of data all without having to submit the main
page and wait for it to return.
...and as an aside (and barely related) question, how about XML? I though it
was just another markup language

It's really a low-level tool for building high-level markup languages.
These days it's the only game in town for that level.
but I'm being told to stop using ASP and
start using XML for my database apps.

That's a nonsensical statement. ASP, XML and a database are all
different things. XML has sometimes been used as a database, but it's
very bad at it.
 
N

Neredbojias

With neither quill nor qualm, Noozer quothed:
OK, I'm at a loss here... I've spent some time on Google and Wikipedia and
still don't understand just what Ajax is...

It's something women use to clean the bathroom and kitchen with.
Not sure if this is the best group to ask this in, but I really don't see
any others which are more relevant.

Well, we _do_ have certain abrasive issues...
 
S

Stan McCann

How it does it is that it breaks the old HTML dependence on HTTP,
and a single "get page, submit page, get page, submit page"

Sorry, that's the way the web was designed to work.
sequence. Bits of JavaScript code and a component that can retrieve

Which is a good enough reason not to use it. You run your programs on
your computer; I will run my programs on my computer. And if I don't
know you, or I've never seen any information about your program; I damn
sure ain't going to run it on my computer.

Client side scripting is, and has always been a bad idea. If it were
more limited on what it could do on someone elses computer, ok, but I
don't want my window resized, I don't want you to take away all the
buttons on the window that I am familiar with and know how to use so
that you can put some buttons in place that I don't know how to use.

Javascript is always off until I know what a page author wants to do
with it (IF I bother to look or care).
 
H

hywel.jenkins

Stan said:
Sorry, that's the way the web was designed to work.

How does it feel to be stuck in the 80s?

Which is a good enough reason not to use it. You run your programs on
your computer; I will run my programs on my computer.

No one's running programs on your computer. Except you.

And if I don't
know you, or I've never seen any information about your program; I damn
sure ain't going to run it on my computer.

No one's asking you to.

Client side scripting is, and has always been a bad idea.

Why? Please explain without resorting to the usual misguided cliches.

If it were
more limited on what it could do on someone elses computer, ok, but I
don't want my window resized, I don't want you to take away all the
buttons on the window that I am familiar with and know how to use so
that you can put some buttons in place that I don't know how to use.

I think you've missed the point. Entirely.

Javascript is always off until I know what a page author wants to do
with it (IF I bother to look or care).

You're the sort of person that hinders technological progress. Why
don't you just buy something made my Smith Corona and ditch your
computer.
 
N

Noozer

Toby Inkster said:
It is something that you can do by combining a few existing technologies:

Thanks for the great example.

So it really just refers to how a webpage can submit/retrieve data from the
server without reloading the page.

Sounds pretty useful. Best done on intranet sites, but I can see it used on
the web as well. Also seems to be the first valid use for hiding the
navigation buttons on a web browser - something you'd never do anyplace but
in an intranet app.
 
D

David Segall

Stan McCann said:
Sorry, that's the way the web was designed to work.


Which is a good enough reason not to use it. You run your programs on
your computer; I will run my programs on my computer. And if I don't
know you, or I've never seen any information about your program; I damn
sure ain't going to run it on my computer.

Client side scripting is, and has always been a bad idea. If it were
more limited on what it could do on someone elses computer, ok, but I
don't want my window resized, I don't want you to take away all the
buttons on the window that I am familiar with and know how to use so
that you can put some buttons in place that I don't know how to use.

Javascript is always off until I know what a page author wants to do
with it (IF I bother to look or care).
Casual users do not need a rich client and there is usually no
justification in complicating a web application for them. However, for
sovereign applications the usual web interface is worse than useless.
Imagine spending all day using a spreadsheet program that required a
"Submit" every time you wanted to see your changes. Ajax is just the
current fashion in the attempt to merge the advantages of web based
applications with the features of desktop ones.
 
H

hywel.jenkins

David said:
Casual users do not need a rich client and there is usually no
justification in complicating a web application for them.

That's true. However, including technology such as AJAX doesn't need
to complicate the application. "Casual users" may be more familiar
with desktop software that gives instant feedback. AJAX allows
near-instant feedback to the browser, and when done properly can
improve the (and I hate to use the phrase) user experience. Google
Maps and Google Suggest are two examples of it done well, though the
clever part isn't the AJAX aspect of it, of course.
 
S

Stan McCann

Casual users do not need a rich client and there is usually no
justification in complicating a web application for them. However,
for sovereign applications the usual web interface is worse than
useless. Imagine spending all day using a spreadsheet program that
required a "Submit" every time you wanted to see your changes. Ajax
is just the current fashion in the attempt to merge the advantages
of web based applications with the features of desktop ones.

The web is not an application. Nor do I want it to be as explained
above. Do you really want every crappy programmer in the world running
their crappy programs on your computer? I don't. I visit web pages
for information and that doesn't usually have the need for instant
feedback as with a desktop application that I have read about to know
that it is relatively safe and I know what it is going to do before it
does it.
 
A

Andy Dingley

Stan said:
I visit web pages for information and that doesn't usually have the need for instant
feedback as with a desktop application

Have you ever used Google Maps ? Report back when you have.

Do you really want every crappy programmer in the world running
their crappy programs on your computer?

Crappy programmers are safe. I need to be protected from the competent
but evil ones. Once they're safely sandboxed, then I'm also happy for
the crappy ones to have a go.

If you really need to, then just let things run on trusted sites, with
non-crappy programmers (Google Maps might be a good start).
 
T

Toby Inkster

Noozer said:
Sounds pretty useful. Best done on intranet sites, but I can see it used on
the web as well.

Once you add a non-AJAX (preferably non-JS) fallback mechanism, it is
certainly suitable for use of the Wild Wild Web.
 
A

Andy Dingley

The web is not an application. Nor do I want it to be as explained
above. Do you really want every crappy programmer in the world running
their crappy programs on your computer? I don't.

Hey Stan, go and take a look at "Greasemonkey"

Your head will probably explode :cool:
 
D

David Segall

Stan McCann said:
The web is not an application. Nor do I want it to be as explained
above. Do you really want every crappy programmer in the world running
their crappy programs on your computer? I don't. I visit web pages
for information and that doesn't usually have the need for instant
feedback as with a desktop application that I have read about to know
that it is relatively safe and I know what it is going to do before it
does it.
Obviously I did not explain clearly what I meant. Ajax and alternative
technologies are not intended for _you_. All the sites you need to use
and who want you to visit will work with Javascript turned off.

A rich web client is necessary when users need to use a web based
application extensively for their day-to-day work. Have a look at
http://www.salesforce.com/. A large company could afford to install a
Customer Relationship Management system using, say, a virtual private
network and a thick client. Salesforce.com provides similar
performance using their servers and only a web browser installed on
the users machine. Similar applications are being developed for
in-house applications because the network is simpler to maintain and
they are much easier to deploy.
 
A

Alan J. Flavell

All the sites you need to use and who want you to visit will work
with Javascript turned off.

That's pretty much what I'd concluded: any web site that tells me that
I can't get anything from it unless I turn Javascript on, doesn't
really want to be visited.

I was reading an amusing account of a German savings-bank web site
which refused to work without the user turning on Javascript. Once JS
had been turned on, the site offered, amongst other things, a link to
security advice from the German banking industry, which told its
readers that for security reasons they must *turn off* Javascript
before visiting any banking site. "Hence or otherwise deduce..."
 
H

Harlan Messinger

Neredbojias said:
With neither quill nor qualm, Noozer quothed:


It's something women use to clean the bathroom and kitchen with.

Men use a different product? How strange. Different brands of clothing
and personal hygiene products are often marketed to the two sexes, but
that's the first time I've heard of sex-specific branding of household
cleansers.
 
H

Harlan Messinger

Stan said:
Sorry, that's the way the web was designed to work.

Operating system and batch input on punch cards, batch output on line
printer when the operator gets around to it: that's the way computers
were designed to work.

DOS, the command line, single-tasking, and an interrupt table at the
base of memory: that's the way PCs were designed to work.

(I'm not disagreeing that even with the bells and whistles added, a
general web site should also function without Javascript. I'm just
reacting to your above remark.)
 
N

Neredbojias

With neither quill nor qualm, Harlan Messinger quothed:
Men use a different product? How strange. Different brands of clothing
and personal hygiene products are often marketed to the two sexes, but
that's the first time I've heard of sex-specific branding of household
cleansers.

What's even stranger is that your remarks imply there _is_ a connection
between men and household cleansers... <rolls eyes />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top