Slashdot Mirror


Creating Web Pages With Ajax

Ravi writes "Asynchronous Javascript And Xml, popularly known as Ajax, is a combination of Javascript, XML and some coding on the server side. Even though this technology existed for years, many believe it was Google which brought it to the front by implementing it on its sites and thus raising it to the cult status it enjoys now. There is something magical in seeing a website update its content without reloading the whole page, which is the visual essence of Ajax." Read the rest of Ravi's review. AJAX - Creating Web Pages with Asynchronous JavaScript and XML author Edmond Woychowsky pages 390 publisher Prentice Hall rating 9 reviewer Ravi ISBN 0-13-227267-9 summary A useful introductory book in picking up the skills in using Ajax

I found the book titled "AJAX — Creating web pages with Asynchronous JavaScript and XML" authored by Edmond Woychowsky to be a very good introductory level book on learning the basics of Ajax. Spanning 390 pages and 16 chapters, this book imparts a sound understanding of the basic features which make ajax possible.

The author starts by giving a brief introduction to the different types of web pages — static and dynamic, the tools and code used to serve them.

In the second chapter which is titled "Introducing Ajax", the author dives into the philosophy and principles of Ajax and with the aid of three simple examples explains three different ways of implementing ajax in a webpage. I found this chapter to clear some of the doubts that a newbie will have about the hype surrounding ajax.

The third chapter takes a step backwards in that it gives a birds eye view of all the XHTML elements and their associated attributes. The author also provides a table which lists the most commonly used CSS 1 elements. I found this chapter more of a ready reference than an indepth thesis on XHTML and CSS.

The fourth chapter titled "Javascript" provides a very good understanding of the language. Javascript plays an invaluable part in the greater scheme of the working of Ajax. Apart from the snippets of code and explanations, this chapter also has a number of tables listing things such as the essential JavaScript functions, characters used to create regular expressions, event handlers, Javascript operators and so on.

In the next chapter titled "Ajax Using HTML and JavaScript", the author explains how to use HTML, Javascript and stored procedures incorporated in the latest version of MySQL to create a semblance of an Ajax shopping cart. What is worth noting is that this chapter explains an old fashioned but very reliable technique which uses hidden frames and inline frames to update the data on the page. Of course the author is quick to point out that this technique is not really Ajax in the sense that it lacks the XML part.

I found the author's narration quite refreshing as he explains each concept one at a time with the aid of snippets of code, gradually building up and eventually tying all the threads together to write a true Ajax web application.

XML — eXtensible Markup Language is the successor of SGML — the language which powers HTML. XHTML on the other hand uses the XML schema. XML is a vast subject which can easily fit in a book of its own. Perhaps knowing this, and because XML plays a significant part in Ajax, the author has intelligently provided just the necessary information about XML in the sixth chapter.

The seventh chapter is a very important chapter which gives an indepth understanding of the XMLHttpRequest object which can be considered the brain behind Ajax. The author also provides some insights into the XML document object model, RSS and Web services such as SOAP.

In Chapter 8, the author gives a more indepth take on the XMLHttpRequest object and the other technologies explained in the previous chapter and illustrates by applying them in building a shopping cart application. Throughout the book, the author has highlighted the fact that ajax is a browser dependent technology and if people disable javascript in their browsers, then the whole effort will come to naught.

XPath is a technology which can be used to locate and navigate the various parts of an XML. The ninth chapter gives an introduction to the syntax used by XPath.

The next two chapters explain the concept of eXtensible Stylesheet Language for Transformations (XSLT) and how it can be used to implement Ajax. XSLT can be compared in some ways to CSS but is much more powerful and can be used to display pure XML in different styles targeting diverse media. These two chapters contain all the necessary details such as the syntatic reference and snippets of code which walks one through creating an Ajax application using XSLT.

In chapter 12, the author talks about the advantages of code reuse where creating javascript objects are explained. Surprisingly, there are two chapters on Ruby on Rails — the latest fad with the web developer community.

I found the book to be a valuable reference for upcoming Ajax web programmers. The number of tables listing the tags and their attributes itself will more than make up for the cost of the book. It has the right amount of content covering all pertinent topics without overwhelming the reader, which makes it a very good introductory book on Ajax.

Ravi Kumar is passionate about all things related to open source and free software and likes to share his thoughts and experiences related to these through his site "All about Linux".

You can purchase AJAX - Creating Web Pages with Asynchronous JavaScript and XML from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

101 of 146 comments (clear)

  1. Re:WHAT by WebHostingGuy · · Score: 1, Funny

    Now, now Mel. You aren't supposed to be drinking in the middle of the day.

    --
    Quality Hosting e3 Servers
  2. Like frames, eh? by xxxJonBoyxxx · · Score: 2, Insightful
    There is something magical in seeing a website update its content without reloading the whole page
    Like frames, eh? (Or Java, Flash, older Javascript apps, etc. etc. etc.)
    1. Re:Like frames, eh? by DittoBox · · Score: 1

      Frames are evil and are on their way out. Flash is evil and requires a closed source plugin to be able to play, it doesn't work on 64-bit browsers under *nix and worse off *nix doesn't even have the latest version. "older javascript apps"...Like what?

      --
      Good. Cheap. Fast. Pick Two.
    2. Re:Like frames, eh? by stupidfoo · · Score: 4, Funny

      it doesn't work on 64-bit browsers under *nix

      Oh noes! There goes 0.0001% of the market!

    3. Re:Like frames, eh? by DittoBox · · Score: 1

      They used to say that about supporting Mozilla when IE was so big...

      --
      Good. Cheap. Fast. Pick Two.
    4. Re:Like frames, eh? by tomknight · · Score: 1

      As it happens I had a hard time getting Flash to work on Linux on my PPC Mac. Then I realised - I was happier without it. Really, Flash is a real bane most of the time. Once you get rid of it you miss a whole load of annoying ads and get to bitch about websites with crappy Flash user interfaces.

      --
      Oh arse
    5. Re:Like frames, eh? by DittoBox · · Score: 1

      I just use AdBlock Plus under Firefox, works like a charm. http://adblockplus.org/en/

      --
      Good. Cheap. Fast. Pick Two.
  3. json by sirdisc · · Score: 2, Informative

    Google definitely didn't invent it. At this point I think more people are using JSON for the data format versus xml. There is just way too much overhead associated with xml. There are a host of javascript and other programming langauge libraries built up to make mall this more easy. For example, the dojo toolkit for javascript has functions for sending the request and decoding the JSON for you automatically. It also provides some framework for passing parameters, handlign errors, and more. Then JSON.org has a host of built up libraries in Java, Perl, C++, Ruby, ...(many many more) for encoding the data to send back. It's all very easy to do now.

    1. Re:json by sirdisc · · Score: 1

      XML is a waste fo time for my applicatiosn actually and a huge mumber fo develops. take a look at the last Ajax conference. Google also choose to not usexml for googlemaps. I've actually spoken to their developers face to face about it. XML was just a processing nightmare and generally not feasible depending on your application. The overhead is just too high. Someone in house here did in fact do the timing comparisons you listed here. There are trade-offs depending on the complexity of the data coming back. If the data isn't complex and is frequently requested, JSON is clearly the way to go. When you return data in a complex struture, xml probably makes the most sense, but then i wouldn't be using Ajax for such a thing personally. It's just nto a good use case. So I have no use for xml really.

    2. Re:json by sirdisc · · Score: 1

      I apologize for the typos above...reformatted XML is a waste of time for my applications actually and a huge number of developers. Take a look at the last Ajax conference. Google also choose to not use xml for googlemaps. I've actually spoken to their developers face to face about it. XML was just a processing nightmare and generally not feasible depending on your application. The overhead is just too high. Someone in house here did in fact do the timing comparisons you listed here. There are trade-offs depending on the complexity of the data coming back. If the data isn't complex and is frequently requested, JSON is clearly the way to go. When you return data in a complex struture, xml probably makes the most sense, but then i wouldn't be using Ajax for such a thing personally. It's just not a good use case. So I have no use for xml really.

    3. Re:json by drumsetdrummer · · Score: 1

      It isn't so much the runtime difference between parsing XML vs using JSON as much as the development time involved. If you use XML, you have to spend time coding the XML generation on the server side and then code the XML parsing on the client. Even if you use a hidden element with XML as you suggested, you still have to then create custom code to pull out the needed data.

      If you use JSON, all you have to do on the server side is retrieve the object/collection (DTO/Value Object) from your business logic and call a library function to convert that into a JSON construct that is streamed to the browser. On the client side, you simply have JavaScript eval() the XmlHTTPRequest.responseText and you instantly have the same object/collection to work with as a JavaScript object.

      That's why it makes so much more sense to use JSON vs. XML.

  4. Review reads like... by angelzero · · Score: 3, Funny

    ...a 4th grade book report.

    1. Re:Review reads like... by Mateo_LeFou · · Score: 2, Funny

      Would get a perfect score on that new SAT essay test, though...

      --
      My turnips listen for the soft cry of your love
  5. yawn by Anonymous Coward · · Score: 1, Informative

    just get .net 2.0 and atlas

    1. Re:yawn by ClosedSource · · Score: 1

      What are the multiple things that other servers understand that ASP.NET servers don't?

    2. Re:yawn by Joey+Vegetables · · Score: 1

      How to run on non-Microsoft platforms?

    3. Re:yawn by ClosedSource · · Score: 1

      Sure, ASP.NET 2.0 doesn't run on Unix platforms, just as most other web servers only run on Windows and Unix compatible OS's. I was looking for a more significant factor. In my view you pick the web server that works best for your requirements and then choose the OS that it runs best on. If I were using Apache and it ran best under Linux, I couldn't care less whether it also runs less efficiently under Windows.

  6. Last time I... by Anonymous Coward · · Score: 2, Funny

    ...made a webpage out of AJAX, the FBI arrested me for attempting to poison the world as a terrorist act.

  7. AJAX by nmb3000 · · Score: 5, Funny

    My biggest problem with AJAX is the popular misconceptions that surround it. For example, I was speaking to somebody a few days ago and they asked me how I would implement some survey widget as a webpage. I thought about it for a bit and told them it would be pretty easy with some PHP and MySQL. I was informed that my idea is "old and outdated". It appears this guy had already hired somebody and he is "coding it in AJAX and Dreamweaver".

    I suggested that AJAX is nice, but it's not a programming language, and more importantly it is not always the best solution for a problem. His reply? That I need to get more "2.0 centric". I was done at this point, but not before informing him that Web 2.0 is little more than pastel colors and BS.

    Surprisingly, the reason he asked me in the first place is that the guy they hired has been working on the system for the last 3 months with "little visible progress". Oh well, at least he's "2.0" enough for them.

    --
    "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
    /)
    1. Re:AJAX by Dynedain · · Score: 5, Insightful

      To which you should have replied "PHP and MySQL are normally a part of AJAX". And you probably would have landed the job instead of getting into a semantics discussion with someone who obviously doesn't understand the technology.

      --
      I'm out of my mind right now, but feel free to leave a message.....
    2. Re:AJAX by Frosty+Piss · · Score: 2, Funny
      To upgrade PHP and MySQL's image to the "new" Iterweb, they should revise their versioning to include the "2.0" moniker...

      PHP 2.0! MySQL 2.0 Just pass it on over to the marketing gurus...

      --
      If you want news from today, you have to come back tomorrow.
    3. Re:AJAX by darkchubs · · Score: 2, Funny

      yeah man , eye balls, who needs money... we can get all the money in the world. its the new new economy 2.0.4 ... get with the times, your so... release candidate 2.0. Now it you'll excuse me my star bucks mocha double late wont drink its self and my segway is double parked. TTFN

    4. Re:AJAX by celardore · · Score: 2, Funny
      The guy they hired has been working on the system for the last 3 months with "little visible progress". Oh well, at least he's "2.0" enough for them.


      Haven't you heard the rule that it can't be web 2.0 unless it is in 'beta'?
    5. Re:AJAX by nmb3000 · · Score: 1

      To which you should have replied "PHP and MySQL are normally a part of AJAX". And you probably would have landed the job instead of getting into a semantics discussion with someone who obviously doesn't understand the technology.

      True enough, though they weren't looking to hire anyone. He was just asking what I thought of it because I'd told him that I've done webpages in the past.

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
    6. Re:AJAX by MoogMan · · Score: 1

      Maybe, but I don't think you'd get much job satisfaction with a boss who has a complete lack of understanding about web design - Phrases like "Hey, where's the Flash?" and "Can you rewrite that page using AJAX?" spring to mind.

    7. Re:AJAX by LordLucless · · Score: 1

      And you probably would have landed the job instead of getting into a semantics discussion with someone who obviously doesn't understand the technology.

      This is supposed to be a good thing?

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    8. Re:AJAX by tehcyder · · Score: 1
      Web 2.0 is little more than pastel colors and BS.
      And tiny illegible fonts. Don't forget the tiny illegible fonts.
      --
      To have a right to do a thing is not at all the same as to be right in doing it
    9. Re:AJAX by nmb3000 · · Score: 1

      And tiny illegible fonts. Don't forget the tiny illegible fonts.

      Ha ha! True enough.

      Of course there's always the exception to the rule :)

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
  8. Ajax is... by SethEaston · · Score: 1, Funny

    Ajax is definitely at the forefront of what we think of as "Web 2.0" or Symantec Web technologies. The whole point of pushing web applications forward is to make them more like desktop applications that run natively (and I am not talking about Flash, Java applets, or stuff that requires 3rd-party software or requires stuff to run on the client machine except for JavaScript). In my mind, that is when the Symentec Web will finally arrive, and Google is already making it happen.

    1. Re:Ajax is... by Anonymous Coward · · Score: 1, Funny
    2. Re:Ajax is... by jo42 · · Score: 2, Funny

      Could you run that management/marketing speak through a To Plain English filter and repost. I didn't understand a word you pecked out on yer keyboard and then posted...

    3. Re:Ajax is... by uradu · · Score: 1

      Wow, I was actually going to fire off an empassioned response, until I landed on this jewel:

      > I give it two more years and it will be the latest in a line of bad ideas - javascript, dynamic html, xml rpc, java applets, etc.

      Move along, nothing to see. Hope that rock fits you comfy.

    4. Re:Ajax is... by GnuDiff · · Score: 1

      Gmail is surely doomed now.

    5. Re:Ajax is... by ClosedSource · · Score: 2, Interesting

      "What's truly significant is the ability to make web requests and processing in the background."

      This is really just a hack to get around the fact that web standards weren't designed for anything beyond static pages. A better solution would be to rework these standards so that any user interaction with an HTML element could optionally trigger a request. For most web apps this would make Javascript unnecessary.

    6. Re:Ajax is... by jazir1979 · · Score: 1


      Can I ask why you lump XML-RPC in that list of Bad Ideas?

      Any technology can be misused, but it takes alot more than that to call it a Bad Idea.

      --
      What's your GCNSEQNO?
    7. Re:Ajax is... by 955301 · · Score: 1

      It's not incorrect and you just cited a few reasons why. very careful, complicates bookmarking - a significant part of the browser, and proposing thick clients as web applications. Nevermind breaking the back button, and the fact that you have not reached the maintenance mode that I speak of yet.

      In your one application you might not have ran into web app issues; however, I guarantee that you are dropping possibilities that are available in a java app for example. The event handling model, the 2d and 3d api's.

      Also, I've never heard of anyone referring to HTML as bloating for an XML message ;)

      Give it time, my friend, and you will regret your architectual decisions.

      --
      You are checking your backups, aren't you?
    8. Re:Ajax is... by 955301 · · Score: 1

      Any technology can be misused; however, some are more inclined to misuse than others. XML-RPC inside the company is wasted overhead during a period where companies like Google and Intel are struggling to reduce processing power consumption. Even James Gosling will tell you when faced with ipc between a pair of remote components he's write to a socket over serialization, xml, or whatnot.

      I just finished an application exchanging java objects -> xml -> CORBA -> XML -> Java because the developer of the other service didn't know better and refused to budge.

      But I hear what your getting at - between corps or corps and customers readability is helpful. But almost every api I've seen would not be worse for wear if all end tags were just instead of . Just that change alone would lop a few percentage points off the average xml message.

      --
      You are checking your backups, aren't you?
    9. Re:Ajax is... by jazir1979 · · Score: 1

      Ahh cool, thanks for the explanation, and I agree with you. I've just finished working on an exchange rate feed with a bank supplied by XML-RPC, which is probably the perfect kind of inter-corp scenario that you described. (They chose XML-RPC of course, not us as the clients).

      Getting curl/openssl/xmlrpc-c to compile and run correctly on HP-UX however, was another matter entirely.

      --
      What's your GCNSEQNO?
    10. Re:Ajax is... by sirdisc · · Score: 1

      >It's not incorrect and you just cited a few reasons why. very careful, complicates bookmarking Actually no. In my use cases, it hasn't affected bookmarking at all. >Also, I've never heard of anyone referring to HTML as bloating for an XML message ;) I'm struggling with grasping what you are referring to here. Not quite sure where you got this from. And yes, of course, a desktop app has more functionality overall. That simply isn't a question. But Ajax has closed the gap some. Some projects that weren't possible before are now possible on the web. Also web apps bring significant advantages over desktop apps in other areas. From changing versions, accessability, scalability (depends on the architecture of your desktop app), platform independence (yes multiple browsers but that is far easier than writing multiple versions of an app for multiple operating systems).... Anyway, as always, it comes down to the particular project needs. If I run into a piece of this very large system I can't implement as a web app, I write a desktop version for it (java web start most likely). I hardly think I'm going to regret anything. We have steadily over the last 8 years been moving apps to a web environment where we can and there are huge payoffs (centralizing the applications both from a hardware perspective, software prespective, accessability to the user, easier linking between applications, on and on). Sure we have some desktop apps that are data intensive (I'm at a biotech in research), but a majority by far have been implemented as web applications and it's been very, very, very successful.

    11. Re:Ajax is... by sirdisc · · Score: 1

      Argh the returns got stripped above.

      >It's not incorrect and you just cited a few reasons why. very careful, complicates bookmarking Actually no. In my use cases, it hasn't affected bookmarking at all.

      >Also, I've never heard of anyone referring to HTML as bloating for an XML message ;)
      I'm struggling with grasping what you are referring to here. Not quite sure where you got this from.

      And yes, of course, a desktop app has more functionality overall. That simply isn't a question. But Ajax has closed the gap some. Some projects that weren't possible before are now possible on the web. Also web apps bring significant advantages over desktop apps in other areas. From changing versions, accessability, scalability (depends on the architecture of your desktop app), platform independence (yes multiple browsers but that is far easier than writing multiple versions of an app for multiple operating systems).... Anyway, as always, it comes down to the particular project needs. If I run into a piece of this very large system I can't implement as a web app, I write a desktop version for it (java web start most likely). I hardly think I'm going to regret anything. We have steadily over the last 8 years been moving apps to a web environment where we can and there are huge payoffs (centralizing the applications both from a hardware perspective, software prespective, accessability to the user, easier linking between applications, on and on). Sure we have some desktop apps that are data intensive (I'm at a biotech in research), but a majority by far have been implemented as web applications and it's been very, very, very successful.

  9. About 60% of visitors have javascript enabled by KalvinB · · Score: 3, Informative

    http://www.freeringtoneheaven.com/ has tracked over 70,000 ips and about 64% have javascript enabled. At http://www.icarusindie.com/ with 78,000 ips tracked only about 38% have javascript enabled.

    The only reason FRH is higher is because visitors were required to have javascript enabled in order to download ringtones. That restriction has been removed. Icarus Indie has never required javascript to be enabled. It just keeps statistics. The sites keep track by using javascript to switch an image from a jpg to a php script. Those without js just see the jpg and those with see the image returned by the php script which also updates the database to indicate the ip has js enabled.

    AJAX may be cool but if you use it you better have a good reason to convince people to turn javascript on or you're just going to lose visitors.

    There were all kinds of Javascript security issues not too long ago and people still don't trust it.

    1. Re:About 60% of visitors have javascript enabled by Anonymous Coward · · Score: 1, Interesting

      i am willing to bet that 99.9% of the entire population of web users have javascript enabled because (1) they don't know how to turn it off, (2) even if they did they wouldn't because 'nothing would work' and (3) there is absolutely NO REASON to disable it unless you are a whiney /. reader

    2. Re:About 60% of visitors have javascript enabled by Anonymous Coward · · Score: 1, Interesting

      I'll happily believe a larger than expected percentage of users have javascript disabled, but this is just insane. Did these sites make any attempt to filter out bots? I'm very much suspecting not...

    3. Re:About 60% of visitors have javascript enabled by gaspar+ilom · · Score: 1

      You just have to know when to apply it.

      For any critical, publicly-accessible site where you want anyone and everyone to go -- AJAX may be a poor choice, unless you can get every AJAX (and JavaScript) feature to "degrade" in some useful manner.

      However, if you're making the front-end to some administrative application for a corporation w/ a locked-down browser spec, then AJAX could be essential, and more than just a buzzword.

      ( ...and it's *still* useful for many mass-marketed sites, e.g.: feature-rich web apps like gmail and google maps.)

    4. Re:About 60% of visitors have javascript enabled by Greenisus · · Score: 1

      An important aspect of a properly developed AJAX application is graceful failure. Use AJAX not as a requirement, but an enhancement of the user experience. I believe gmail, for example, will work without javascript enabled, but the experience isn't nearly as fluid.

    5. Re:About 60% of visitors have javascript enabled by sgt+scrub · · Score: 1

      This sounds like the flash only argument of days old. Check the browser for compatibility. If flash isn't on send them to plan b. The parent makes the most important point. Tons of people don't trust public websites with js on them anymore.

      --
      Having to work for a living is the root of all evil.
  10. Re:He should get Paula to do this... by Osty · · Score: 2, Informative

    Wrong forum, dude. Besides, Paula's more enterprisey than ajaxy.

  11. Ajax is NOT even a... by darkchubs · · Score: 1

    This is the last Ajax post Im going to make... its getting silly at this point I get asked about it everyday. its not a language , its not even a standard... its a silicone valley buzzword made up by a guy named Jessy James . Ask someone to make you a www2 homepage for fear that your web 1.0 one will be outdated and not run on Windows vista in the long run the only winner in the hype is a hand full of early bandwagon companies (like my ajax company :) ) and Colgate-Palmolive who get all this free publicity. Ricahrd Corsale

    1. Re:Ajax is NOT even a... by Namlak · · Score: 1


      Ask someone to make you a www2 homepage

      Come on, everyone knows that everyone knows that you want a wwww homepage now.

    2. Re:Ajax is NOT even a... by FST777 · · Score: 1

      The exciting part of AJAX is solely the name. It's nothing more than two existing JavaScript methods combined: XMLHttpRequest (which essentially has nothing to do with XML) and responseXML (which in some cases can better be replaced by handling plain text or evalling JSON, the latter being a buzzword on its own).

      Both aren't new. Only XMLHttpRequest is a bit stunning, but not even much. It's the fact that the use of both combined has gotten a name and that some intelligent folk (Google is an example) are now using it for making better web-applications (like email, chat, mapviewing etc).

      It's not the next big thing in webdesign either. It is just a reminder to webdevs: hey! have you thought of using this()? And it has (sadly) become a buzzword (which is to remind us webdevs how stupid we were not to have thought of the uses of XMLHttpRequest earlier).

      --
      Free beer is never free as in speech. Free speech is always free as in beer.
  12. Re:AJAX Is The Latest Greatest Buzzword by darkchubs · · Score: 1

    you cant index the content in a flash SWF.. so making dyna sites with it would really hurt your chances of ranking on your target term.

  13. XSLT by gaspar+ilom · · Score: 3, Interesting

    I find it interesting that the review mentions XSLT, which, IMHO, is very powerful:

    You can completely separate most display logic from the "data" and business logic. (...which can be handled before the XSL transformation, and done such that you get XML nodes to feed into your transformations.)

    It may seem complicated at first, but there are so many advantages:

          1.) you get the layout of the site defined in a declarative manner, basically as as data. (and that XSL "code" can be easily analyzed or transformed, itself.)

          2.) you can disentangle a lot of markup from your PHP/ASP[VBS/JScript]/Python code.

          3.) The output of your XSLT transformation can be fed into other transformations.

          4.) Your XSLT is highly portable across platforms, even between server vs. client-side rendering.
    (Although, it bums me out that Microsoft has decided to not support XSL 2.0.)

          5.) Manipulating an X/HTML dom via a browser's built-in XSLT processor is much faster than using JavaScript only. (E.g.: using JavaScript-only to traverse a DOM in order to select, merge, append, and move nodes...)

    I'd be curious to know what this book has to say on the matter.

    1. Re:XSLT by Ed+Woychowsky · · Score: 1

      You're right, it is much faster. Another advantage is that the XSL can be cached, which will reduce the amount of traffic going back and forth. To qoute Patten, "Never pay twice for the same real estate."

  14. Like regular applications, eh? by iamacat · · Score: 1

    Once upon a time people were stuck with screens refreshing slowly on RS232-connected terminals or lags of busy centralized servers. Then they realized they can have a small computer right on their desk and get instant response. Why would anyone want to go back to retro lag? I am not saying applications shouldn't be installed or auto-updated form the web, but is JavaScript + text data files really a perfect client side UI? There is Java, .Net and even C++/Objective C in a virtualized sandbox.

    1. Re:Like regular applications, eh? by suparjerk · · Score: 1

      The analogy doesn't quite work. If the server is running so slowly that neato AJAX updateamajigs aren't working right, the same lag would be apparent if normal complete page refreshes were being made. It still has to retrieve data from the server, so AJAX isn't really introducing any problem that wouldn't be there otherwise. And I don't think it's feasible to download the entire Internet onto your computer and work locally.

      --
      I caught the Mountain Wumpus! He gave me his treasure chest ($100) to let him go free again.
    2. Re:Like regular applications, eh? by iamacat · · Score: 1

      Dude, I am talking about regular native apps, not web forms. While you don't want to "download the whole Internet", I don't see why I should upload my every button click to google.

    3. Re:Like regular applications, eh? by GnuDiff · · Score: 1

      Because that's the way browsers have been working so far?

      If anything, you are uploading (and downloading) less, by not having to re-download the whole GUI (webpage) all the time.

    4. Re:Like regular applications, eh? by iamacat · · Score: 1

      Again, why should every application should limit itself to functionality of Internet Explorer 6 if all major browsers support plugins that can enable much more appropriate programming environment?

    5. Re:Like regular applications, eh? by myz24 · · Score: 2, Funny

      Yea! Lets create a way for people to extend the functionality of IE...lets call it ActiveX! BRILLIANT!

    6. Re:Like regular applications, eh? by Sancho · · Score: 3, Insightful

      It depends completely on what you're trying to accomplish.

      The AJAX model shines for web applications. You know, applications where you need to make frequent requests to the server. Flash can do this, but as others have said, you get the same latency issues with Flash making queries to the server as with an AJAX-like application.

      AJAX seems like a terrible idea for standalone applications, which is what you said in an earlier post. So far, I haven't seen a single AJAX application that didn't query a server somewhere. The reason for this is precisely because we have better options: Java/Flash if you want to stay in the browser, standalone applications if you don't.

      Maybe we've all just misunderstood you. Gmail is arguably the best-known AJAX application. Its primary user-interface is web-based. If you're suggesting that web-based e-mail is a ridiculous concept because you could just download a standalone client, download your messages, and read them off-line, I can see that as a valid viewpoint. But the reason that web applications exist (in general) is because nearly everyone has access to a web browser. You don't have to download a new program for each website you want to use. Imagine taking this idea to the extreme and having to download Google Internet Search rathern than just pointing your browser to http://www.google.com/. Wouldn't that seem a little weird (I'm old enough to have used Archie and Gopher, so no jokes about the young ones, please)

      Web browsers are good middleware because they're ubiquitous. Everyone who has an Internet connection has one. Using the functionality of the browser (much like the Java sandbox, incidentally, which you said was valid in http://books.slashdot.org/comments.pl?sid=200963&c id=16458167) rather than writing a complete application has a number of advantages, not the least of which is version control (being able to ensure that people are using the latest version of your software, no version mismatches, etc).

      I think AJAX is an interesting model, and I'll be following its adoption with interest. I don't think it's the end-all be-all of computing, but I don't think it's completely without merit, either. Then again, I don't have anything against traditional web applications, for the most part, so that may be where our viewpoints differ.

    7. Re:Like regular applications, eh? by suparjerk · · Score: 1

      YES!@ *high-five!*

      --
      I caught the Mountain Wumpus! He gave me his treasure chest ($100) to let him go free again.
    8. Re:Like regular applications, eh? by zero_offset · · Score: 1

      Gmail is arguably the best-known AJAX application

      I thought Google Maps was supposed to be the big important world-changing app that brought us the name...??

      I'm still kicking myself for not giving this technique a name (and self-promoting For The Win!!!1!) when I started using it this way about seven years ago when IE5 showed up. It seemed like such an obvious thing to do. Within a few weeks we had built a pretty solid, easy to use RPC mechanism around it for internal use, long before SOAP had a name (and long before the standards-nerds mangled SOAP into the hellishly over-complicated monster that it is today -- back then I begged Dave Weiner not to do this, apparently to no effective result).

      You know, it's funny how these /. articles never seem to mention that this glorious XMLHttpRequest revolution is entirely based on a Microsoft addition to XML parsing. I think the only place I've ever seen that directly mentioned is on the Apple Developer pages about AJAX (ah yes, here).

      Sorry, rambling... to swerve back on topic -- wasn't Google Maps supposed to be THE fancy new AJAX web-app???

      --

      Slashdot quality declines as the number of hot grits posts decreases. - Provolt's Law, Apr-09-2005

    9. Re:Like regular applications, eh? by FunkyELF · · Score: 1

      So to buy something from a web site I should download their own application written in C++ to browse their store and add things to my shopping cart?

  15. Re:AJAX Is The Latest Greatest Buzzword by Shados · · Score: 1
    Ultimately, AJAX is nothing more than spagetti Javascript and HTML.
    Thats why frameworks like ASP.NET AJAX (formerly known as Atlas) come in to solve that issue. When you use Atlas (a much more appropriate name than its new one, as Ajax is only a fraction of the framework), you get to use classes, inheritence, interfaces, and all around reusable constructs in your javascript. So it is anything BUT spagetti code.
  16. Re:AJAX Is The Latest Greatest Buzzword by tetranz · · Score: 1

    True.

    You can do very cool Ajax stuff in ASP.NET relatively easily with 3rd party controls from companies such as:

    http://www.telerik.com/
    http://www.componentart.com/

    and others.

  17. Re:WHAT by P3NIS_CLEAVER · · Score: 1, Funny

    Races that didn't do any fucking died out centuries ago.

    --
    Please sign petition to restore sanity to our banking system!!!

    http://financialpetition.org/
  18. Re:AJAX Is The Latest Greatest Buzzword by fithmo · · Score: 1
    By the time Macromedia Flash v10.0 rolls out, AJAX will be relegated to the dustbin of technological history, much like Java applets...

    Really? Uh oh! Somebody better tell Google they need to redo all their apps in Flash, or they'll fail big time!

  19. AJAX has it's time and place by se7en11 · · Score: 1

    Here's my couple of rules when to and when not to use AJAX (from experience)

    Do nots:
    1) Navigation - save yourself both time and effort and just pass varables in URLs.
    2) Application depend on it - like someone mentioned above, not everyone has Javascript enabled.

    Dos:
    1) Prevent popup windows - there's no reason to popup a window to make a small choice. Just switch the DIV with AJAX and make the choice done from within it.
    2) Small enhancments to a site - like to scrol through a couple news clips or something similar

    I'm sure there are more but I really need to get back to fixing my AJAX application-dependant-navigation-system. ;)

    1. Re:AJAX has it's time and place by FST777 · · Score: 1

      I'm currently building a IM-application for bussiness websites (visitor clicks, talks to salesman / support). Please do tell how to do this without JavaScript while not having to fall back on a META-refresh every second (which is annoying enough for my clients not to buy the product and is more often prevented than JavaScript is)

      Some apps depend on XMLHttpRequest by nature, not by design.

      --
      Free beer is never free as in speech. Free speech is always free as in beer.
  20. no ips are filtered by KalvinB · · Score: 1

    I don't make any attempt to filter out bots so you can feel free to subtract as many IPs as you feel is reasonable from the total number of IPs counted. But when you're starting at 38%, you're going to have to dismiss a lot of IPs to justify breaking your site for a lot of people just because you want to use AJAX.

    The other thing that should be noted is that IcarusIndie is mostly visited by technical people. Free Ringtone Heaven is more mainstream.

    If you're using AJAX on a technical site you're going to have a lot more people with javascript turned off. If your site is more mainstream you'll have fewer people with JS turned off.

    I'd highly recommend setting up a simple tracker like I have because every site is different. Once you have a number you're confident is accurate enough, then you can decide if making javascript necessary is a worthwhile thing to do.

    Keep in mind that no javascript means no AdSense being displayed and possibly other ad systems. When I require JS, ad revenue goes up. Your results may vary.

  21. Ajax draw backs... by rHBa · · Score: 1
    No chapters about the many problems with most ajax implementations then? Namely:
    • Broken back button
    • No updates to browser history
    • The inability to link to an ajax populated web page

    I have built a few simple ajax apps but found the workarounds necessary to get these standard browser features working again not worth the effort in most cases.
    1. Re:Ajax draw backs... by Shados · · Score: 1

      There are ways to get around this. If I remember well, for example, the GWT (is that the right name? The google toolkit for web UI) handles the back button and such while dealing with Ajax.

      That being said, Ajax shouldn't usualy be used in situations where you need these features. If you do, it was probably a bad place to use ajax in the first place. Things like cascading combo box, sorting grids/tables of data, paging (debatable), etc, is where its useful. Basical, all features that should be handled client side, but because of ressource and performance issues, are handled server side. Of course, things like sorting client side can be dealt with without ajax if you have a LOT of time on your hands, or use one of the many frameworks around to do it. But when you don't have access to these things, or need a custom solution, ajax helps. If your users want to be able to link to something, then ajax is probably not the best of solution. It definately has a lot of other amazing uses though.

      Plus, there are all the web business solutions... web apps that mimic desktop apps. In these scenarios, obviously you don't care nor want a user to be able to link to something, so its peachy to ajax it across the board to make the user experience better. I have a framework I made myself, that uses divs and javascripts and a third party framework on top of ajax to mimic an entire window manager, so the user can deal with the entire application like they would a desktop one, and the page never, ever refresh. Yet it retains the scalability and cross platform compatibility of a web app. It works pretty well, users loved it. Right tool for the right job :)

    2. Re:Ajax draw backs... by rHBa · · Score: 1
      Right tool for the right job


      You're absolutely right of course, I was just wandering if the book covered these issues as it is not mentioned in the review.

      IMHO a shopping cart is not a suitable use for ajax as many users may want to send a link to a specific product to a friend. "But it is the 'cart' not the 'shelves' that is updated with ajax" I hear you say, well if you refresh the page every time you view a new product why use ajax in the first place?
    3. Re:Ajax draw backs... by bugg · · Score: 1

      Funny, I was just thinking that one of the nice things about AJAX was the ability to keep the back button behaving as users expect.

      An example (roughly inspired by a recent project I was working on):

      Say a user has a bunch of search results, and for each result they can navigate to a page where they can modify fiddle with things and push a lot of buttons and submit a few forms to change the data. Most users, myself included, would still want 'back' to take them to the search results, not to an earlier form.

      And of course, I should point out that it's also not an option to render a page where you've handled the POST data, because users tend to reload and hit back and most folks don't understand the 'this page contains POSTDATA...' warning that browsers (thankfully) give. So before, to keep the navigation and to a lesser extent specifically the back button working sanely on a form-heavy site, it required juggling redirects and response codes to bring the user back to where they wanted.

      In my recent, javascript-heavy application, the form submissions were all handled by javascript, so the back button always took you back to the last full page you viewed. Broken back button? Not here...

      --
      -bugg
    4. Re:Ajax draw backs... by rHBa · · Score: 1

      The first 'app' I wrote that used XMLHttpRequest (not even real AJAX as the http response is ready-made html) was an rss feed reader. You select a feed from a box (or enter a url in an ) and an XMLHttpRequest is made which responds with the feed formatted as html. The response could just as easily have been the feed itself which would be formatted client side (true ajax) but this makes no difference to my point.

      You now have your nicely formatted slashdot rss feed displayed on the page, you read the first news item and click the link to read peoples posts at slashdot.com. Once finished you click the browser back button to read the next news item except that the web page now displays the default feed, not the slashdot feed you changed it to. I have disabled the XMLHttpRequest functionality for now until I have fixed this issue (the page was designed from the beginning to work with or without ajax for users who disable js).

      Would you say that I chose the wrong tool for the job in this case? An rss feed would seem like the perfect implementation at first glance.

      The second 'app' I wrote was an implementation of weather.com's XML API. As the requirements of use are that you cache weather data all xml parsing had to be done serverside so this was another non-xml/ajax 'app'. I would pm you a link to it but you posted as an "Anonymous Coward" so I will include a link here (this news item is old enough and this post deep enough that I don't feel like I'm doing any shameless self promotion):

      http://www.boardair.com/weather.php

      In this case the broken back button wasn't a problem as the user is unlikely to want to read the weather information again after leaving the page.

      I would appreciate your feedback on whether I used the right tool for the job in these two cases.

  22. AJAX still uses a HTTP request by kippers · · Score: 1

    It is the people who think AJAX pages don't send requests over the internet that I worry about.

    'Oh, AJAX is cool, saves people having to wait for pages to load.' The content has got to come from sonewhere.

  23. The Latest Greatest Buzzword by Scrameustache · · Score: 1

    the typical end user (and most MacInfags) sure loves the stuff.

    You email your mother with that keyboard?

    --

    You can't take the sky from me...

  24. Re:AJAX Is The Latest Greatest Buzzword by kippers · · Score: 1

    Yes, but adverts are so much more annoying in flash.

  25. Microsoft's OWA most popular AJAX by lawman508 · · Score: 1

    I always think it's funny when people say that "Web 2.0" technologies are going to put Microsoft out of business. In fact, Microsoft OWA (Outlook Web Access) is by far the most popular, and in my opinion one of the best, AJAX programs released to date.

  26. Try the XForms standards-compliant AJAX by leighklotz · · Score: 2, Insightful

    Try AJAX with markup only, no hand-written JavaScript, by using the W3C's XForms standard. There are a number of implementations such as the Servlet-based Chiba (which fronts for Dojo and other packages), FormFaces written entirely in JavaScript (no server-side component), entire server-side pipeline systems such as Orbeon, and full client implementations such as the Mozilla/Firefox XForms Extension (just type "xforms" into your Firefox extensions finder), FormsPlayer IE Plugin, or cell-phone capable implementations such as PicoForms and SolidForms.

    I wrote an entire webmail reader using PHP for the back end and XForms for the client. It runs in the Mozilla XForms implementation but could easily be made to work in any of the above, which differ mostly in how the CSS works. xmlmail

    And for completness, I was an editor of an earlier version of the W3C XForms recommendation.

    1. Re:Try the XForms standards-compliant AJAX by leighklotz · · Score: 1

      I'm not sure what you mean by "select1" being an error; please let me know.

      There are certainly efforts going on to bridge between HTML and XForms, so watch this space.
      But if you're interested in binding a UI to XML data you already have, it's a best-fit solution.
      Also, it's not clear that the size of XForms is any different from the size of large JavaScript solutions.

      When you say
          <submission id="update" replace="instance">
      what happens is that when you put a submit button down with
          <submit submission="update">
      then it will submit the XML data in an HTTP POST with the XML MIME type, and the HTTP server will respond with another XML document. (See http://del.icio.us/leighklotz/xforms for a series of articles by Nicholas Chase at IBM DeveloperWorks on how to get PHP, Perl, Java etc. to do this.)

      When the instance data is updated, either by the server response or by your using a UI control bound to one of the nodes, all data display changes are driven automatically.

      For example, to implement COPPA, you just write one boolean expression that says this:
            <bind nodeset="/application/personalInfo" relevant="/application/age >= 13" />
      then taht means that the entire tree of data under the <personalInfo> element won't be "relevant" if the age is under 13. Then the UI system follows this directive and will not display any UI controls bound to those nodes (presumably email, name, address, etc.). Likewise, the submission system follows the directive and won't submit them either.

      Then, to fully simulate the COPPA experience, you can put
            <bind nodeset="/application/personalInfo/email" required="true()" />
      which tells the submission system that email is required, so you can't submit without it. It also tells the UI system that it's required, and that gets shown as CSS property :required, which you can style in CSS like this:

            input:required { color: red; }

      Is this a good enough start of showing how XForms fits with XML and HTML and CSS?

  27. AJAX was a Microsoft invention. by Anonymous Coward · · Score: 2, Informative

    Actually, it is a Microsoft invention. No kidding. The Outlook Web Access (OWA) team are the ones that lobbied the Internet Explorer team to include the (original) XMLHTTP object; which was originally MADE by the OWA team.

    It's fair to say that OWA for Exchange 2000 was the _first_ AJAX application. They started development of it all in 1998.

  28. If anyone doesn't know about Noscript by Beryllium+Sphere(tm) · · Score: 1

    My all time favorite Firefox extension, Noscript, blocks Javascript in a flexible way that allows whitelisting by domain either permanently or temporarily. It's really fun to click and be able to turn on Javascript for just the site you're interested in and none of the advertisers on it.

  29. Re:390 pages and 16 chapters? by P3NIS_CLEAVER · · Score: 1

    Thanks for reminding me about how much I hate Javascript.

    --
    Please sign petition to restore sanity to our banking system!!!

    http://financialpetition.org/
  30. AJAX and Flash have a lot in common... by rHBa · · Score: 1

    ...they both break the standard features of your browser like a back button but at least ajax content is visible to search engine robots

  31. Re:AJAX Is The Latest Greatest Buzzword by LanMan04 · · Score: 1

    making my 2ghz CPU feel like a P2 running at 200mhz

    Don't worry, Vista will do that for you! Sure you don't want one of those Macinfags, you know, the one that has an OS that runs faster on the same hardware with each new release?

    --
    With the first link, the chain is forged.
  32. Google? by CDPatten · · Score: 3, Insightful

    "think" is the important word when suggesting Google had something to do with AJAX. They have had NOTHING to do with it's creation seeing how that is up to the makers of web browsers. Microsoft really invented the functionality while most of the slashdotters were still getting wedgies in school.

    The term AJAX may have been coined a couple of years ago in an article, but MS deserves the credit. Its also worth noting they were using it on microsoft.com before most of us had even heard the word google.

    Lets see how many of you can swallow that and actually give them their do.

  33. semantics... by chachacha · · Score: 1

    Erm, that would be SEMANTIC web, as in the word "semantic" (see http://dictionary.reference.com/browse/semantic) not Symantec, as in the security software company (see http://www.symantec.com/index.htm).

    It's all semantics, anyway I guess. Jesus.

    --
    I do like programming things that work super quickly, especially when they work super quickly, super quickly.
  34. Re:json, XML,nah -- just return HTML by avecfrites · · Score: 1

    The simplest way to use "ajax" is to have the server send a chunk of HTML (a small table, or a paragraph, e.g.) to the browser, where the javascript just sticks it in the page where you want it. You don't need to use XML, JSON, or anything complicated. With the simplest approach, the user is essentially submitting a form inside your page and getting the result right back in the same place, with no parsing involved. I don't know why more people don't take this easy way out -- it substantially lowers the bar for getting started with ajax.

  35. Re:AJAX Is The Latest Greatest Buzzword by Shados · · Score: 1

    Viewstate can be handled server side (except for a very small bit of data to track the server side part of course, though care needs to be taken for security, but thats easy), so its honestly a non-factor. Postback is to use asp.net specific page model. You don't have to use it, and its very simple to get back to the stone age if you don't want all these features, using the standard navigation and form models. Its not that way by default since ASP.NET aims more to mimic a desktop app's flow. But again, it is simplistic to not use those features. They are optional. Though if you don't want them, things like Java with Strut or are vastly more appropriate.

  36. Re:AJAX was a Microsoft invention. by miletus · · Score: 1

    Love that URL -- msexchangeteam.com They're the ones working on a gender interchange protocol, right?

  37. Re:Flapjax by sammyo · · Score: 1

    Please please please tell me this does a server round trip
    transaction for each letter increment! Totally 'two dot O'

    http://www.flapjax-lang.org/demos/letter-count/run .html

  38. Re:AJAX doesn't create web pages. by LifesABeach · · Score: 1

    AJAX is the name given to the collection of language protocols of XML, XSLT, XSD, CSS, HTML, and Javascript. Microsoft would have you believe that you need a COM, or DOM object; But it is not necessary, and prone to cracking. It is best to start out with a client side XML page, and a XSLT line inserted to produce the web page. The top 4 browsers all can handle XML using the XSLT. If you need separate functionality, make use of a web service; Simple. And if you use this set of tools, your project completion will get done faster, and look better for it. Basically, many good things will happen if you include the AJAX set of tools.

  39. Re:390 pages and 16 chapters? by Spliffster · · Score: 2, Interesting

    nice example.

    in theory this might work, ever tried to use "try() {...} catch() {...}" in IE6 ? good luck. the xmlhttprequest interfaces are not 100% the same on all browsers (which support it), one still has to write crossbrowser code, i could go on for days (there are many nice "ajax" libraries which deal with these issues).

    I haven't read the book ,however i was always happy with the oreilly books on javscript, because these books pointet out most of the browser differences/annoyances to keep in mind while designing.

    Cheers,
    -S

  40. Re:AJAX was a Microsoft invention. by orasio · · Score: 1

    It was an evolution, not a revolution.
    Using a small or invisible frame/iframe to send hidden requests was older than that.
    And lots of people (at least me) used to push some logic to the javascript side, and modify html input elements according to other elements.
    Hidden (or shown) iframes were/Are great for queries.

    The same behavior of ajax pages could be acheived, and the effect for the user was the same. All without a C00l buzzword.

  41. Re:He should get Paula to do this... by rhymesmith · · Score: 1

    But we all know that Paula is versatile. She might already have created a brilliant AJAX application.

  42. Re:json, XML,nah -- just return HTML by gnalre · · Score: 1

    It definately has its place.

    However generally there is no right answer, only the one best for you. For example it depend how much load you want your browser to take compared to your server. Our servers are embedded devices, so it makes sense to send the raw data(in JSON or XML) and let the javascript on the broswer create the page. On the other hand some times its better to as you say just send raw HTML(Tables especially can be a nightmare, I always seem to end up losing memory when deleting and creating table rows)

    --
    Choose your allies carefully, it is highly unlikely you will be held accountable for the actions of your enemies
  43. AJAX will kill itself by Loundry · · Score: 1

    Prevent popup windows - there's no reason to popup a window to make a small choice. Just switch the DIV with AJAX and make the choice done from within it.

    This is bad news. Basically, it means that advertisers will exploit AJAX to make mind-blowingly annoying ads. This is why we have popup blockers in the first place: the marketplace of eyeballs has limits on how much it can stand to be annoyed. It's also why the Flashblock extension exists: to block the world's most annoying ads. But now we have applications that will depend on AJAX (a.k.a. JavaScript) to function, which means that we have no way of blocking out that "div" which will likely be something so annoying it will make you want to bite your monitor. What else can people do beside shutting off JavaScript altogether?

    --
    I don't make the rules. I just make fun of them.
  44. AJAX isn't best for in-house apps either by ClosedSource · · Score: 1

    Of course the primary advantage of a web app is the ability to be used from a variety of OS's. If you have an in-house application and you can control the configuration of the computers, a "fat client" application is probably going to be easier to develop and give a better user experience than an AJAX-based one.

  45. Re:AJAX was a Microsoft invention. by sirdisc · · Score: 1

    this is entirely correct and obvious. Iframes and addressing the window.opener allowed you to do some of the same things but it would be incredibly ugly way to control content in the window opener. But you have far more a framework built up now for handling sending parameters, handling errors, controlling the layout better... It's far different than submitting a simple url via an iframe.

  46. Re:390 pages and 16 chapters? by roman_mir · · Score: 1

    this was not an example on proper Javascript, it was an AJAX example. Besides, this code is cross browser. It works in FF and in IE6 (I have IE 6.0.2900 and FF 1.5, works in both.)