Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Mastering Ajax Websites

ScuttleMonkey posted more than 8 years ago | from the breaking-it-down dept.

The Internet 307

An anonymous reader writes to tell us that IBM DeveloperWorks has an interesting article introducing the uninitiated to the world of Ajax. From the article: "Ajax, which consists of HTML, JavaScript technology, DHTML, and DOM, is an approach that helps you transform clunky Web interfaces into interactive Ajax applications. The author, an Ajax expert, demonstrates how these technologies work together. Ajax is more than just the latest fad -- it's your stepping stone to build better Web sites through efficient use of your time."

cancel ×

307 comments

Sorry! There are no comments related to the filter you selected.

Ever notice . . . (5, Insightful)

Ph33r th3 g(O)at (592622) | more than 8 years ago | (#14236069)

. . . how when a new fad comes along, people say it's not a fad?

Re:Ever notice . . . (0)

Anonymous Coward | more than 8 years ago | (#14236083)

and how everyone who writes anything about AJAX is an "Expert" ?

Re:Ever notice . . . (3, Interesting)

Kickboy12 (913888) | more than 8 years ago | (#14236273)

I fail to see how anybody can be an "Expert" at something that is nothing more than a couple lines of code and a function or two. People seem to attribute "AJAX" to an entire javascript feature, when the part of the code that is actually "AJAX" is so small it's not worth mentioning. Not the mention the term AJAX seems overused and more complicated than it really is. It's basic javascript, nothing fancy or advanced or special.

There's way too much hype over such a small thing. It gets annoying.

Re:Ever notice . . . (1)

Parham (892904) | more than 8 years ago | (#14236290)

That article didn't seem so "expert" to me; it just seemed like every other article. So yes I agree with you, I don't know why some people are claiming to be "experts" in this field when it's really not a field but rather a combination of different fields. Most articles that are coming out about AJAX seem to be saying the same thing though. I have to say also, that these articles are teaching me a lot about what AJAX means, how to use it, and what to use it for. The basic code they show with explanations is nice.

Re:Ever notice . . . (5, Insightful)

ceejayoz (567949) | more than 8 years ago | (#14236085)

Sure, but when something useful comes along, people say it is a fad.

Look at what Google Maps did for online mapping and tell me AJAX is "just a fad".

Re:Ever notice . . . (2, Insightful)

QuietLagoon (813062) | more than 8 years ago | (#14236241)

Sure, but when something useful that is called a fad comes along, everyone thinks it will solve all the problems they face? Even those it doesn't?

Re:Ever notice . . . (4, Insightful)

phoenix.bam! (642635) | more than 8 years ago | (#14236087)

Ajax is a fad and it isn't. All the hype about it is of course, generated because it's the awesome new fad. But it is an incredibly useful tool. Digg.com does a great job of using AJAX the proper, no intrusive way. GMAIL too. It's great for some things and won't be going away soon. But soon there won't be 20 stories a week posted about it.

Re:Ever notice . . . (5, Funny)

baldass_newbie (136609) | more than 8 years ago | (#14236089)

That's why I use COMET (Common Object Meta Event Transactions) instead of AJAX.
It keeps my websites Spic and Span.

Oh wait...

Re:Ever notice . . . (4, Funny)

BorgCopyeditor (590345) | more than 8 years ago | (#14236122)

Better watch out! Despite his bald head and suspiciously gay-looking earring, Mr. Clean is gonna kick all y'all's asses!

Re:Ever notice . . . (0, Redundant)

robertgeller (882730) | more than 8 years ago | (#14236132)

That's _exactly_ what I was going to make a comment about -- before I saw yours.

It's so true, too.

Javascript is just a kludge -- and so is AJAX.

Re:Ever notice . . . (1)

heinousjay (683506) | more than 8 years ago | (#14236209)

Javascript is just a kludge -- and so is AJAX.?

Anything to support that opinion? I mean, it's pretty damn sweeping. I suspect you don't even really understand Javascript - which is nothing unusual for a detractor.

Re:Ever notice . . . (1)

robertgeller (882730) | more than 8 years ago | (#14236324)

Anything to support that opinion? I mean, it's pretty damn sweeping. I suspect you don't even really understand Javascript - which is nothing unusual for a detractor.
"Understand" JavaScript? How can anyone understand JavaScript, first of all? Secondly, I understand it insofar as most any programmer does -- I understand what it can do and how to accomplish the things I need to do with it. Do I "understand" it like I do a great language like Python? Hell no! Why? Because it's impossible to understand like the latter. Regarding AJAX being a kludge, the concept isn't, but the implementation is. It's implemented in JavaScript, which, by definition, makes it kludgy.

Re:Ever notice . . . (1)

heinousjay (683506) | more than 8 years ago | (#14236342)

Ah, so no, you can't support the opinion. That would have been simpler to say.

There's definitely a weird prejudice against Javascript, and I think you've expressed it perfectly. I spent a lot of time recently defending it, professionally speaking. Most people that told me it was useless didn't even realize that it's a fully object oriented language. The prototyping throws people expecting classes way the hell off.

In the end, though, any language with closures is going to be one mighty powerful tool.

Re:Ever notice . . . (2, Informative)

baldass_newbie (136609) | more than 8 years ago | (#14236363)

JavaScript has some nice features that you won't find in any reference book or 'teach yourself' whatnot.

In fact, I'm surprised at how agile the classes and objects can be. Once you get a handle on arrays and start thinking along the lines of JSON [crockford.com] for your asynchronous work, you'll be ahead of the game. (Not you personally, just 'you' generically.)

Re:Ever notice . . . (1)

larry bagina (561269) | more than 8 years ago | (#14236402)

When Javascript came out, I didn't like it. Netscape hangs, gives weird errors, and the tacky animations. What's not to like? But when you separate the language from the hordes of copy/paste "web designers" and the DOM (and MS/Mozilla differences), the JavaScript/ECMAScript/ActionScript language is a decent programming language.

Re:Ever notice . . . (1)

creimer (824291) | more than 8 years ago | (#14236176)

Fads sells over-priced books [amazon.com] . Go figure.

Re:Ever notice . . . (0)

Anonymous Coward | more than 8 years ago | (#14236254)

.NET was "not a fad", either. I never believed it, not even when it got fluff-laden hype stories routinely posted to developers.developers.developers.developers.slashd ot.org.

Ballmer doesn't throw chairs, he just has very lousy juggling partners.

LAMPS + RoR + AJAX = WTF?? (3, Funny)

Urusai (865560) | more than 8 years ago | (#14236337)

I'm bored with these paradigms. Can we invent some new ones already? I propose Flash + Ads + Porn + Paypal = FAPP.

It's not just a fad!

Re:LAMPS + RoR + AJAX = WTF?? (1)

jrockway (229604) | more than 8 years ago | (#14236380)

Paypal's ToS says they have the right to drain your bank account if you mention "mature content" on your website... so I doubt FAPP will catch on.

Re:Ever notice . . . (2, Insightful)

qray (805206) | more than 8 years ago | (#14236396)

Ajax and its predicessors, to me, are poor attempts to patch problems with building web applications. It's unfortunate that we haven't seen real solutions to the problems of building web applications. I'm surprised at how excited people get over things like CSS and Ajax.

At this point in the game, we shouldn't have to be jumping through hoops and playing games to get great looking web applications. Web applications should be on par with traditional applications.

--

Q

From the article (1)

codyhess (716905) | more than 8 years ago | (#14236415)

"Ajax is far more than just a fad" They never said it wasn't a fad. It's fad++.

How to become an AJAX Expert (2, Funny)

Anonymous Coward | more than 8 years ago | (#14236071)

Call yourself one.

Re:How to become an AJAX Expert (1)

AndroidCat (229562) | more than 8 years ago | (#14236392)

Nah. The job listings call for at least 5 years of AJAX experience for experts.

Re:How to become an AJAX Expert (0)

Anonymous Coward | more than 8 years ago | (#14236413)

My 5 years of AJAX experience go very well with my 20 years of Java experience.

Well done (4, Informative)

gustgr (695173) | more than 8 years ago | (#14236082)

Interesting post. This kind of introduction might help beginners (like me) to know more about this new mix of different technologies and avoid confusion. Just these days a friend of mine said to me that he would like to learn this new "Ajax programming language". Many people still think that way. Thumbs up for the article.

Masterbating Ajax Websites? (-1, Troll)

Anonymous Coward | more than 8 years ago | (#14236088)

Porn for nerds?

Stuff that splatters?

Forget Ajax (1, Funny)

Gryle (933382) | more than 8 years ago | (#14236092)

Pinesol has waaaaay more cleaning power

How about a new language (1, Interesting)

zymano (581466) | more than 8 years ago | (#14236097)

Instead of a complex hybrid why not a new language ? Half the opinions about Ajax is that it's not worth all the effort. Too complex.

What about Python or something new just for interfaces ? Something like Macromedia Flash ?

Re:How about a new language (1)

ceejayoz (567949) | more than 8 years ago | (#14236110)

Client-side Python? How long, exactly, should we wait for Internet Explorer to add support for that?

Anyone who finds basic AJAX "too complex" needs to try the Prototype [sergiopereira.com] library [particletree.com] .

Re:How about a new language (1)

AOL-CD-Man (920944) | more than 8 years ago | (#14236393)

The Prototype library? I would, if that website [particletree.com] was available.

Re:How about a new language (1)

mr_stinky_britches (926212) | more than 8 years ago | (#14236149)

Or, why not a completely new language (as the parent originally stated)? I kind of like that idea ;)

I can't say anything about Python, but I can tell you RIGHT NOW that "Macromedia Flash" (is it now considered a language?) is not suitable for or geared towards making the best use of my time.

Have you tried Laszlo? (5, Informative)

spoco2 (322835) | more than 8 years ago | (#14236285)

Not trying to spruik it or anything, but I'm currently working on a project of making a webapp using Laszlo [openlaszlo.org] .

It's an open source language/server for creating flash based applications.

We've found it to be very impressive how much you can do with so little code... and it's nice to have a proper OO backend to a flash frontend... the flash frontend means we can:

a) Make our interface very pretty and like a 'normal' application
b) Means it works in pretty much any browser...
c) on pretty much all platforms...
d) without a download of any plugin in most cases (just because of the penetration of flash)

Re:How about a new language (2, Insightful)

Geoffreyerffoeg (729040) | more than 8 years ago | (#14236157)

Half the opinions about Ajax is that it's not worth all the effort. Too complex.

Too complex? As compared to what? Having each and every server-side action also generate a page for the user? With AJAX, you can have one or two pages for display, and the rest of the scripts just for sending or retrieving data.

Re:How about a new language (2, Insightful)

robertgeller (882730) | more than 8 years ago | (#14236187)

I don't think the parent was implying the AJAX, itself, is too complex, but rather that JavaScript is, a statement which I entirely agree with. To do anything in JavaScript requires many lines of code -- and kludgy code, to me. JavaScript needs to either be seriously revamped or entirely rewritten. Unfortunately, the time it will take to a) get this new language written and, most importantly, b) get it standardized in all the major browsers (*ahem* especially IE) would probably just be too long. I don't think JavaScript is going to get a major revamp anytime soon. I think it's time for an alternative, though. Hey, client-side Python would be great; I'm all for it! :)

Re:How about a new language (0)

Anonymous Coward | more than 8 years ago | (#14236177)

If you really want you can "invent a new language" and write a compiler to compile it into the "complex hybrid code" that runs on current browsers.

Re:How about a new language (1)

shobadobs (264600) | more than 8 years ago | (#14236197)

Seriously, AJAX is not complex. Maybe it is for people who can only copy and paste Javascript from other web pages. But the concept of AJAX is simple, Javascript is one of the most elegant programming languages out there. I can see why one might want to adapt Python, though, for its batteries.

Re:How about a new language (1)

johnMG (648562) | more than 8 years ago | (#14236262)

I can see why one might want to adapt Python, though, for its batteries.

Yeah, Python comes with some nice Alkaline C cells. Perl OTOH comes with those big deep-cycle bruisers like you find in fork lifts.

Re:How about a new language (5, Interesting)

Fahrvergnuugen (700293) | more than 8 years ago | (#14236198)

Well, as soon as we get all of the web browsers out there to adopt your so called "new language", we'll be all set. Your comment about Macromedia Flash made me laugh. Explain to me how Action Script interacting with the server with XML.send() is any different than JavaScript using XMLHttpRequest??

Obviously you're not a web developer ;)

Instead, how about a JavaScript 2.0? The language is only short a few key elements (like a native JSON serializer).

I started developing web based applications 7 years ago. At that time, JavaScript was really only useful for image mouse overs and was more or less useless and I refused to use it for anything.

Well, about 8 months ago I decided to give JavaScript another chance. All I can say is, wow it's come a loooong way.

I'm a bit skeptical of all of the frameworks that have popped up. They seem to overcomplicate things profoundly. I've looked at a lot of them, but haven't decided that any of them are less work than the solution I developed on my own.

My approach is to use JSON instead of XML. I have a server side script (can be any language, I used PHP for my last application) which acts as a listener script. The listener script accepts and sends JSON strings. The client JS composes and sends JSON strings with XMLHTTP request.

It's clean, fast and simple to maintain and expand. I think these claims of AJAX being "too complex" are ridiculous.

Re:How about a new language (1)

adrianmonk (890071) | more than 8 years ago | (#14236216)

Instead of a complex hybrid why not a new language ? Half the opinions about Ajax is that it's not worth all the effort. Too complex.

That's what everyone said about object-oriented programming in about 1990. They said it was too much work, or that it was nothing really all that new, and you could do the same stuff in C if you wanted to.

To some extent they were right, but I think in some cases, that was just a way of saying "it's new and I don't want to learn it".

Re:How about a new language (0)

Anonymous Coward | more than 8 years ago | (#14236263)

How about same language - different platform? OpenLaszlo - XML based language + Javascript, compiles to SWF (Flash), much faster/easier development than typical Ajax frameworks and libraries. It does require Flash, but 90%+ of browsers support it already.

http://openlaszlo.org/ [openlaszlo.org]

Re:How about a new language (1)

zymano (581466) | more than 8 years ago | (#14236399)

I knew somebody would be working on some alternative.

Re:How about a new language (1, Insightful)

Lars83 (901821) | more than 8 years ago | (#14236325)

Websites done in Flash make my ban list.

Re:How about a new language (2, Interesting)

trevorrowe (689310) | more than 8 years ago | (#14236369)

How about a new language [instead] of a complex hybrid why not a new language ? Half the opinions about Ajax is that it's not worth all the effort. Too complex.

I think you just missed the whole point of ajax with that single statement....

Webbrowsers support javascript very well, and have done so for quite some time. Javascript has a nifty object that allows you to asynconously make requests without submitting a page, in the background so to speak. This request might fetch an XML document or might be a specially formated response to the developers liking. Javascript parses this. Then you use javascript to manipulate the DOM of the HTML page to reflect whatever new information you recived.

Why do we need to add or create a new language to do this? Javascript already proves it does an excellent job and any replacement language would have to do exactly the same thing that javascript is doing now? So you want to buy a new horse to replace the old horse, but the new horse isn't going to be any different? Just new?

From the beginning of the article (1)

codyhess (716905) | more than 8 years ago | (#14236423)

"it's not nearly as hard to learn as an entire new language."

Ajax in action (5, Informative)

gustgr (695173) | more than 8 years ago | (#14236103)

A nice example of Ajax usage can be found at http://www.meebo.com/ [meebo.com] .

Re:Ajax in action (2, Insightful)

ceejayoz (567949) | more than 8 years ago | (#14236120)

More useful examples would include Google Maps, Gmail, Flickr, etc.

Re:Ajax in action (2, Informative)

MasterPi (896501) | more than 8 years ago | (#14236230)

More useful!?!? don't know how many hours i've spent looking for a decent browser based jabber client even. The fact that it does AIM and Yahoo as well makes this one of the coolest sites I've found all month. Thanks for the link, g.p.

Re:Ajax in action (1)

Mozk (844858) | more than 8 years ago | (#14236126)

VERY, VERY NICE.

I've been tired of having to use AIM Express, a Java client, on computers that do not have a desktop AIM client. It gets even worse when Java is not installed.

This website is amazing. Even the GUI looks pretty. :)

Re:Ajax in action (4, Interesting)

OverlordQ (264228) | more than 8 years ago | (#14236128)

My only complaint about AJAX sites is it makes bookmarking something damn near impossible.

Re:Ajax in action (3, Insightful)

junjun26 (247061) | more than 8 years ago | (#14236192)

That's why it works so much better for web applications than normal web pages. Why would you bookmark a page in your Gmail account ;)

Re:Ajax in action (1)

Bogtha (906264) | more than 8 years ago | (#14236232)

Bookmarks not working is merely a symptom of a larger problem - the lack of addressability. This also causes other problems. There might not be many people who want to bookmark one of their emails, but I'm sure there's a lot more people who would like to open an email in a new tab every once in a while.

Re:Ajax in action (1)

MasterPi (896501) | more than 8 years ago | (#14236250)

Umm.. ctrl+click link for email. Not to mention the cool little "put this in a new window" buttons for all of the compose/quick-reply boxes. It even keeps the text you were working on.

Btw ctrl+anything works for about any tab related thing. Ctrl+Tab switches, ctrl+enter in googlebar does new tab, etc. Shift usually modifies whether the tab focuses right away or not as well. Just in case anyone didn't know.

Re:Ajax in action (4, Interesting)

Bogtha (906264) | more than 8 years ago | (#14236289)

Umm.. ctrl+click link for email.

...and that would work if Google hired somebody competent to write their Javascript. But they hired people who use spans and onclicks instead of <a href="...">s, thus taking the addressibility away, thus taking the bookmarks, tabs, etc away too.

Re:Ajax in action (4, Insightful)

Bogtha (906264) | more than 8 years ago | (#14236195)

That's not Ajax, that's developers who have screwed up. You can have Ajax and addressability (bookmarks, back button, etc) for 99% of the things Ajax is good for. It's just you have all these newbie web designers jumping on Ajax like there's no tomorrow, so most of the things you see have had lots of shortcuts taken, and some of the things you see shouldn't have used Ajax in the first place.

A good rule of thumb for knowing when it's appropriate to use Ajax is where you intend on posting something to the server, and then redisplaying the page you just came from. For example, Slashdot's moderation. It makes no sense to regenerate the entire page just to tell the server what you think of one particular comment. This is also the situation where bookmarks, the back button, etc aren't going to break.

Re:Ajax in action (0)

Anonymous Coward | more than 8 years ago | (#14236246)

Amen! Mod parent up! Most of the complaints about AJAX and usability stem from examples of misuse, not from a fatal flaw inherent in AJAX itself.

IMO one of the finer points of using AJAX is knowing when not to use it...

Re:Ajax in action (4, Insightful)

Geoffreyerffoeg (729040) | more than 8 years ago | (#14236299)

A good rule of thumb for knowing when it's appropriate to use Ajax is where you intend on posting something to the server, and then redisplaying the page you just came from.

Completely. AJAX should only be used when you would've POSTed something to the server and made a slight change - both of those are non-bookmarkable and non-addressable. (Good) web designers seem used to when to GET and when to POST, so only use AJAX in the latter case. The general rule for that, by the way, is that POST should change stuff on the server, and GET should only retrieve data. Thus, you can only bookmark a view of data, not a change of it - you've already changed it once you're ready to bookmark.

AJAX can actually help with the entire problem of tabs and forms - if the form only changes data but doesn't update the view, you can use a regular link to see a different view of it.

The other solution is to do what Google Maps does - since they're using AJAX to retrieve views, they have a button called "Link to this view" or something that gives you a context-free URI to that particular view.

Re:Ajax in action (1)

Ride Jib (879374) | more than 8 years ago | (#14236257)

You really think I'm going to put my username and password in on that site? You're crazy.

Re:Ajax in action (1)

teslatug (543527) | more than 8 years ago | (#14236395)

No shit, some weird site asks for your credentials without even explaining anything? You've gotta built some credibility and amass enough money to be worried about getting sued, before you'll become trusted.

Re:Ajax in action (1)

jessu (917041) | more than 8 years ago | (#14236385)

Another nice example can be found here FeedTV [feedfeeds.com]

Killing 2 birds with one stone (-1, Flamebait)

Anonymous Coward | more than 8 years ago | (#14236108)

There haven't been enough "introduction to Ajax" articles lately. Or "IBM developer works" articles. Now maybe you can post a "google rules/microsoft sucks" article.

The challenge... (0, Redundant)

Chris Bradshaw (933608) | more than 8 years ago | (#14236112)

The challenge with Ajax Sites... Keeping them dry. Everyone knows Ajax turns blue when it gets wet.

Har-de-Har

JavaScript code is the core code - What??? (4, Interesting)

danwiz (538108) | more than 8 years ago | (#14236123)

From the article:
JavaScript code is the core code running Ajax applications and it helps facilitate communication with server applications.

Depending on JavaScript could be its downfall, since JavaScript has so many functional work-arounds for each browser. Even the article mentions (but dismisses) this problem.

From the article (again):
Microsoft's browser, Internet Explorer, uses the MSXML parser for handling XML (you can find out more about MSXML in Resources). So when you write Ajax applications that need to work on Internet Explorer, you need to create the object in a particular way.

"Particular Way" for browser one ... "Particular Way" for browser two ...
Sounds like in an inherently poor design.

Re:JavaScript code is the core code - What??? (1, Interesting)

Anonymous Coward | more than 8 years ago | (#14236182)

Depending on JavaScript could be its downfall ... Sounds like in an inherently poor design.

While I'm not a big fan of JavaScript, the incompatibilities you talk about aren't JavaScript's fault. They are due to different levels of JavaScript support in different browsers, and the addition of non-standard features by the different browser camps. AFAIK, XMLHttpRequest is not a standard. It was invented by Microsoft, and others found it so useful that all modern browsers now support it, albeit with slightly different APIs. That is the source of the incompatibilities, not JavaScript.

Re:JavaScript code is the core code - What??? (4, Informative)

Bogtha (906264) | more than 8 years ago | (#14236203)

"Particular Way" for browser one ... "Particular Way" for browser two ... Sounds like in an inherently poor design.

The incompatibility you are talking about is the direct result of Microsoft implementing XMLHttpRequest with ActiveX, and everybody else implementing it as a native Javascript object. Microsoft are changing their implementation in Internet Explorer 7 to be compatible with everyone else.

So no "inherently poor design", just a historical artifact that is a) easily worked around, and b) going away.

Re:JavaScript code is the core code - What??? (1)

GigsVT (208848) | more than 8 years ago | (#14236252)

Hmm..

I guess we should thank the people writing and using IE exploits, they will ensure no one uses an obselete IE browser in the coming years.

Re:JavaScript code is the core code - What??? (2, Informative)

Geoffreyerffoeg (729040) | more than 8 years ago | (#14236228)

"Particular Way" for browser one ... "Particular Way" for browser two ...
Sounds like in an inherently poor design.


Yeah, because var req; if (window.XMLHTTPRequest) req=new XMLHTTPRequest(); else req=new ActiveXObject("Microsoft.XMLHTTP"); is such poor design. (req supports the same capabilities now, regardless of method - that's why he said "create".)

The reason behind this is that XMLHTTPRequest was originally a Microsoft idea using ActiveX. When Mozilla, Opera, Safari, etc. realized it was a good idea, they needed a way to create that object even though they didn't support ActiveX (justifiably). And Microsoft just kept its original design.

Re:JavaScript code is the core code - What??? (1)

Bogtha (906264) | more than 8 years ago | (#14236316)

Yeah, because var req; if (window.XMLHTTPRequest) req=new XMLHTTPRequest(); else req=new ActiveXObject("Microsoft.XMLHTTP"); is such poor design.

Well it is ;). It assumes that XMLHttpRequest is implemented in one form or another, it throws an exception when Internet Explorer users have ActiveX disabled, and it doesn't handle Internet Explorer 5.0 (IIRC), which implements the same object, but with a slightly different name.

Re:JavaScript code is the core code - What??? (2, Informative)

Geoffreyerffoeg (729040) | more than 8 years ago | (#14236373)

Well it is ;). It assumes that XMLHttpRequest is implemented in one form or another, it throws an exception when Internet Explorer users have ActiveX disabled, and it doesn't handle Internet Explorer 5.0 (IIRC), which implements the same object, but with a slightly different name

As a rule, you don't post error-checking code in programming discussions. It's assumed that everything's wrapped in a try block.

What I used in my application was copied-and-pasted from Apple's XMLHTTPRequest tutorial [apple.com] , part of function loadXMLdoc(), with appropriate redirects to an error/troubleshooting page if creating the object ultimately failed.

Re:JavaScript code is the core code - What??? (1)

AndroidCat (229562) | more than 8 years ago | (#14236421)

You don't want to know how many different versions of that object are probably listed in your registry. Hopefully the one that snagged the VersionIndependentProgID is the correct one. (Check under MSXML2.XMLHTTP as well.)

Re:JavaScript code is the core code - What??? (3, Insightful)

KiloByte (825081) | more than 8 years ago | (#14236236)

Also, if you consider the popularity of the "NoScript" extension, you'll see that a lot of people turn JavaScript off. Having it permanently disabled is a part of many security policies, as well; I would estimate that at least 10% or so of people will have JavaScript disabled at least on their first visit. This is a lot more than a minority such as "Links users" or "the blind".

So... unless you disregard a significant percentage of viewers, you do need to provide an alternate version.

The article says: "Ajax is more than just the latest fad -- it's your stepping stone to build better Web sites through efficient use of your time." -- tell me how can AJAX save you time if you have to do _both_ versions of the site, multiplied by the number of differently behaving browsers?

Re:JavaScript code is the core code - What??? (1)

QuietLagoon (813062) | more than 8 years ago | (#14236258)

"Particular Way" for browser one ... "Particular Way" for browser two ... Sounds like in an inherently poor design.

Not an inherently poor design, but an inherently poor architecture. If AJAX needs to be browser-specific, it is doomed in the long term.

Think: flash in the pan.

Re:JavaScript code is the core code - What??? (3, Informative)

LordLucless (582312) | more than 8 years ago | (#14236412)

Depending on JavaScript could be its downfall, since JavaScript has so many functional work-arounds for each browser. Even the article mentions (but dismisses) this problem. From the article (again): Microsoft's browser, Internet Explorer, uses the MSXML parser for handling XML (you can find out more about MSXML in Resources). So when you write Ajax applications that need to work on Internet Explorer, you need to create the object in a particular way. "Particular Way" for browser one ... "Particular Way" for browser two ... Sounds like in an inherently poor design.

Im not a huge fan of AJAX, but this is one criticism you can't honestly level at it. Browser incompatibilities exist for pretty much all client-side, web-based technologies, and AJAX has only a single minor change to work around, as opposed to getting a complex CSS layout to work cross-browser. *shudder*

The simplest AJAX app relies on one piece of javascript functionality - the ability to make an http request through script. I've used this a number of times to submit data to a server when I didn't want to update the page.

Most AJAX then also relies on the ability of javascript to parse an XML document (to examine the results of the post) and some form of dynamic page-rewriting to change the current page based on the XML document (generally object.InnerHtml for content changes, or object.style for stylistic ones).

These features are fairly static - there's no need for them to change often. Simple AJAX - which is simply just offloading form submission - is good, useful, and most users don't even know it's there. As long as javascript keeps these three features, AJAX won't have major browser compatibility problems.

AJAX which rearranges the page after each XmlRequest is a bit more troublesome. It's also the flashy bit, which means its the bit every man and his dog tries to do. Using this technique, it is easy to write an entire site in one page - that is, there's one page the user visits, and the page rewrites itself based on their clicks. This is the stupidity of taking AJAX too far; you end up breaking basic functionality of the web (back buttons, refreshing, bookmarking, opening in new windows/tabs).

Why AJAX matters (5, Interesting)

Geoffreyerffoeg (729040) | more than 8 years ago | (#14236129)

AJAX isn't an end in itself; it's just a tool. It's like JavaScript. Back when the web was old, if you wanted to do data validation for a form (for example), you had to send the page to the server and wait for a new page as a response. When JavaScript became popular and well-enough supported, the webpage itself could check data before sending it to the server - although the checks couldn't be that complicated. AJAX is similar; instead of limiting yourself to either using a new page or client-side data, AJAX lets you use JS to access server-side data.

As a concrete example, play with Google Maps [google.com] for a couple of minutes, then try using a map from MapQuest [mapquest.com] . It will quickly start to annoy you that you can't drag the map and that you have to click to a new page to move the map around. GMaps isn't pure AJAX, admittdly, since it deals with picture data - it can just write the image tags to the page and move them around as you drag. But the side text and the map searches are AJAX - when you click search, you don't open a new page with the search results. You can keep using the map; the client will turn your search into an XML request, Google will process it, and send the results back as XML - asynchronously.

For another example, I wrote this week a dead-simple chat program (because I needed a specific feature). It was simpler to write a web app instead of a real app, because the latter would require networking, windowing, and whatnot - the web interface made GUI easy and manual networking irrelevant. Without AJAX, I would need to have the page reload every second to check if there are new messages - very distracting. I had the system asynchronously check for messages in the background, and when one arrived, update just that part without refreshing the page.

AJAX is a tool to be used when necessary. Don't freak out over it, but realize it's there whenever you need to use a more application-like interface instead of a page-like interface.

Re:Why AJAX matters (1)

shobadobs (264600) | more than 8 years ago | (#14236221)

It's like JavaScript.

No, AJAX is Javascript.

Re:Why AJAX matters (1)

ciroknight (601098) | more than 8 years ago | (#14236387)

No, Ajax is an oven cleaner, and AJAX is Asychronous Javascript And eXtensible markup, even though the latter part of that definition goes away when you realize that there are at least 3 other days of getting data back and forth to/from the server that don't involve XML or the XMLHTTP object.

So, AJAX has Javascript in it, but is not javascript. My computer plays games but that doesn't make it a gaming machine.

When is AJAX appropriate? (0, Troll)

Shimmer (3036) | more than 8 years ago | (#14236133)

Correct Answer: When you're building a web site that will have thousands or millions of users and you need maximum polish and usability to keep them.

Incorrect Answer: For the 99.999% of web sites that don't meet the above criteria.

Re:When is AJAX appropriate? (1)

Xugumad (39311) | more than 8 years ago | (#14236199)

You forgot "...and asynchronous updates are useful". For example, one of the major applications I work on is a course management system. We could update the display of which students have uploaded work, in real time, but it would only be of use for those courses where submission has a short window (for example, lab-based courses), and even then I'm not convinced it would be used as a feature. Much of the system is like this; rarely updated data, which isn't that helpful to watch change in realtime anyway.

On the writing to the server side, there are a few more uses (particularly backing up work in progress), but everything I can think of is best only written back when delibrately saved...

Re:When is AJAX appropriate? (1)

Shimmer (3036) | more than 8 years ago | (#14236286)

Good point. There's no point in polishing a GUI that doesn't need that kind of polish.

Re:When is AJAX appropriate? (3, Insightful)

Bogtha (906264) | more than 8 years ago | (#14236213)

You don't need polish to keep users, you only need polish to attract users. Take Slashdot as an example. Hideous design, atrocious implementation, no polish whatsoever, full of bugs, and yet people keep coming back to it.

Once you've attracted users, they rarely go away unless you give them a push (like endlessly posting repetitive articles on Ajax, for example).

Re:When is AJAX appropriate? (1)

ihabawad (756309) | more than 8 years ago | (#14236226)

Amen to that! For most other sites, choosing either plain HTML or a real (Java Web Start or even -- horror -- .Net or native) app is much easier. Mod parent up! :)

Re:When is AJAX appropriate? (3, Insightful)

heinousjay (683506) | more than 8 years ago | (#14236227)

You're almost there, but the number of users has nothing to do with it. You use it when it's appropriate to support a desktopish interaction model, and you don't want to reload the page every time.

Also, I'd clean up the terminology. You don't use it for web sites. You use it for applications.

Re:When is AJAX appropriate? (1, Informative)

Shimmer (3036) | more than 8 years ago | (#14236280)

The number of users has nothing to do with it.

I disagree. Unless you're developing for fun, you need lots of users and/or transactions to justify the extra expense required to implement AJAX.

You use it when it's appropriate to support a desktopish interaction model.

Okay, but that's nearly tautological. The problem is to determine when a "desktopish interaction model" is appropriate.

You don't want to reload the page every time.

Whether you "want" to reload the page isn't nearly as important as whether you can justify the expense of avoiding reloads. Lots of people "want" to use AJAX. That doesn't make it a good idea.

-- Brian

Re:When is AJAX appropriate? (1)

heinousjay (683506) | more than 8 years ago | (#14236320)

I disagree. Unless you're developing for fun, you need lots of users and/or transactions to justify the extra expense required to implement AJAX.

I don't find this request model (I hate the term AJAX) to be expensive to develop, or to run. Took me a week to make the necessary framework level changes and test them, and now it's a matter of setting a few attributes on my custom tags. (I'm using J2EE and a custom framework right now)

Okay, but that's nearly tautological. The problem is to determine when a "desktopish interaction model" is appropriate.

I should have stated this more clearly - it's user driven. My current project is replacing some old desktop apps into an integrated web application. The choices were made before I started, and using this architecture lets me satisfy everyone. Obviously, it's a case by case basis, but if the user is expecting things to be highly interactive, and the project is a web app, then this is the way to go.

If the project isn't customer driven, then I guess it's really just a personal decision. If the system isn't intended to be highly interactive, why bother?

Whether you "want" to reload the page isn't nearly as important as whether you can justify the expense of avoiding reloads. Lots of people "want" to use AJAX. That doesn't make it a good idea.

Again, I disagree with it being expensive. There was some upfront work in my case, but that's over now. Things are actually simpler to develop overall, because individual interactions have very few dependencies now, as opposed to traditional web development.

In the end, of course people will misapply these technologies. That will be true of everything that will ever be invented, though.

Re:When is AJAX appropriate? (1)

Shimmer (3036) | more than 8 years ago | (#14236349)

There's no doubt that AJAX is fundamentally more complex than traditional web development. If you've figured out a good way to abstract away this complexity using a framework, good for you -- and maybe you should share it with the rest of the world.

Re:When is AJAX appropriate? (1)

heinousjay (683506) | more than 8 years ago | (#14236358)

I'm working on that right now - making sure I've got compatible licensing on the dependencies, and documenting. I expect to release it by the end of this month, but that may slide if my project gets hairy. The site will be in my sig when I get it done.

Good but bad! (5, Insightful)

ech00ne (937418) | more than 8 years ago | (#14236134)

AJAX doesn't make it easy to develop cross-platform web applications. Look at all the browser incompatibilities in the developing of Gmail and more recently MSN's start.com page.

We need to re-standarize Javascript or at least make sure all the browsers implement a 100% compatible version. And I don't think that will work since not even HTML is properly rendered by any browser at all.

Re:Good but bad! (1)

heinousjay (683506) | more than 8 years ago | (#14236237)

So apparently the thousands (or more?) of us out here doing it right now should stop and wait for not only a standardization effort, but implementations as well?

I think we'll be just fine dealing with incompatibilities as they arise.

Re:Good but bad! (0)

Anonymous Coward | more than 8 years ago | (#14236366)

While there still are problems, in general the level of standardization is between browers higher now than ever before.

powerful approach (1)

johnMG (648562) | more than 8 years ago | (#14236136)

From the article:
However, Ajax is far more than just a fad; it's a powerful approach to building Web sites and it's not nearly as hard to learn as an entire new language.

Interestingly enough, my current approach to building Web sites is also powerful. So, I guess I'm already all set. :)

Best thing since sliced bread! (3, Insightful)

abelikoff (412709) | more than 8 years ago | (#14236143)

AJAX...helps you transform clunky Web interfaces into interactive Ajax applications.

Recalling the Simpsons: "Only suckers buy [last year's] model. You are not a sucker, are you?"

I can't wait to start padding my resume with the latest and greates technology out there that will do the same thing we've been doing for decade but with more acronyms and steeper learning curve.

Best thing since outsourcing! (0)

Anonymous Coward | more than 8 years ago | (#14236375)

"I can't wait to start padding my resume with the latest and greates technology out there that will do the same thing we've been doing for decade but with more acronyms and steeper learning curve."

Well if you don't learn it, your counterpart in India most certainly will. Elitism is for the unemployed.

Re:Best thing since sliced bread! (0)

Anonymous Coward | more than 8 years ago | (#14236389)

How long have you been doing XmlHttpRequest/Ajax for then? A decade?

Let's Get Picky (3, Informative)

cataBob (529363) | more than 8 years ago | (#14236168)

"Ajax, which consists of HTML, JavaScript technology, DHTML, and DOM, is an approach that helps you transform clunky Web interfaces into interactive Ajax applications."

DHTML is nothing more than javascript and html. And how the heck are you supposed to use javascript without using the DOM, aka Document Object Model? Talk about buzzword compliant...

Re:Let's Get Picky (1)

feNIX77 (512228) | more than 8 years ago | (#14236306)

alert('this isn't using DOM and its javascript!');

Re:Let's Get Picky (2, Funny)

JamesOfTheDesert (188356) | more than 8 years ago | (#14236365)

Ajax, which consists of HTML, JavaScript technology, DHTML, and DOM,

And which one of those is the 'X' in 'AJAX' again?

"Ajax is more than just the latest fad" (2, Funny)

0x20 (546659) | more than 8 years ago | (#14236169)

Somebody should break this news to Hani [jroller.com] .

(It's not going to be me.)

Why is this news? (0)

mattwarden (699984) | more than 8 years ago | (#14236315)

This article contains absolutely nothing novel and is like 100 other introductory AJAX articles. I even recognize code snippets. Why is it on Slashdot?

Poor Brett in the dark (1)

shareme (897587) | more than 8 years ago | (#14236410)

Why not use the javascript way of avoiding activeXObject calls when accessing XMlHttpRequest objects on MISE? Its been in several ajax libraries for the past 4 months! AJAX is all browsers with the XMlHttpRequest object not just MSIE junk..

Recursive definition? (2, Funny)

sirianni (767971) | more than 8 years ago | (#14236417)

"Ajax... is an approach that helps you transform clunky Web interfaces into interactive Ajax applications."

Couldn't have said it better myself...

Ajax, all the problems of time sharing, back again (2, Interesting)

Animats (122034) | more than 8 years ago | (#14236424)

I keep encountering dynamic web sites that sort of work, or have performance bottlenecks. When I close some pages on tribe.net, there's about 10 seconds of disk activity from the browser, during which time the browser locks up. (Does anyone know what they're doing wrong?)

A growing annoyance is a page that hangs during loading because its advertising site is slow. With plain HTML, page rendering isn't delayed for image loading. With AJAX, page load can be stalled while the ad server cranks. I keep seeing "Waiting for servedby.advertising.net" in the browser status line. Fortunately, I can just close the page and go to a competitor.

I just bought 40 backup tapes. First site had some problem with its dynamic stuff. Went to another site and spent money there.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>