Creating Web Pages With Ajax 146
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.
Like frames, eh? (Score:3, Insightful)
Like regular applications, eh? (Score:2)
Re: (Score:1)
Re: (Score:2)
Re: (Score:1)
If anything, you are uploading (and downloading) less, by not having to re-download the whole GUI (webpage) all the time.
Re: (Score:2)
Re: (Score:2, Funny)
Re: (Score:1)
Re:Like regular applications, eh? (Score:4, Insightful)
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/ [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&
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.
Re: (Score:2)
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 lo
Re: (Score:1)
Re:Like frames, eh? (Score:5, Funny)
Oh noes! There goes 0.0001% of the market!
Re: (Score:1)
Re: (Score:1)
json (Score:2, Informative)
AJAX was a Microsoft invention. (Score:2, Informative)
It's fair to say that OWA for Exchange 2000 was the _first_ AJAX application. They started development of it all in 1998.
Not true in the Slashdot universe (Score:1)
Re: (Score:1)
Re: (Score:2)
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.
Re: (Score:1)
Re:json, XML,nah -- just return HTML (Score:1)
Re: (Score:2)
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 ta
Re: (Score:1)
Re: (Score:1)
Review reads like... (Score:3, Funny)
Re: (Score:3, Funny)
yawn (Score:1, Informative)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Last time I... (Score:2, Funny)
AJAX (Score:5, Funny)
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.
Re:AJAX (Score:5, Insightful)
Re: (Score:2)
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.
Re: (Score:2)
Re: (Score:2)
This is supposed to be a good thing?
Re: (Score:3, Funny)
PHP 2.0! MySQL 2.0 Just pass it on over to the marketing gurus...
He should get Paula to do this... (Score:1)
Re: (Score:2, Informative)
Wrong forum [thedailywtf.com], dude. Besides, Paula's more enterprisey than ajaxy.
Re: (Score:1)
But we all know that Paula is versatile. She might already have created a brilliant AJAX application.
Re: (Score:2, Funny)
Re: (Score:2, Funny)
Haven't you heard the rule that it can't be web 2.0 unless it is in 'beta'?
Re: (Score:1)
Re: (Score:2)
Ha ha! True enough.
Of course there's always the exception [wordpress.com] to the rule
Ajax is... (Score:1, Funny)
Re: (Score:1, Funny)
Re: (Score:2, Funny)
Re: (Score:1)
There is a lot contributed by client side code that can't and shouldn't be attempted in a browser. That and the idea of layering your a
Re: (Score:2)
> 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.
Re: (Score:1)
Re: (Score:2)
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.
Re: (Score:2)
I just finished an application exchanging java objects -> xml -> CORBA -> XML -> Java because the developer of
Re: (Score:2)
Getting curl/openssl/xmlrpc-c to compile and run correctly on HP-UX however, was another matter entirely.
Re: (Score:3, Interesting)
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.
Re: (Score:2)
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'
semantics... (Score:1)
It's all semantics, anyway I guess. Jesus.
About 60% of visitors have javascript enabled (Score:4, Informative)
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.
Re: (Score:1, Interesting)
Re: (Score:1, Interesting)
no ips are filtered (Score:2)
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 ha
Re: (Score:1)
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.
(
Re: (Score:2)
AJAX isn't best for in-house apps either (Score:2)
Re: (Score:2)
If anyone doesn't know about Noscript (Score:2)
Ajax is NOT even a... (Score:1)
Re: (Score:1)
Ask someone to make you a www2 homepage
Come on, everyone knows that everyone knows that you want a wwww homepage now.
Re: (Score:1)
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
XSLT (Score:3, Interesting)
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.
Re: (Score:1)
AJAX has it's time and place (Score:1)
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
Re: (Score:1)
Some apps depend on XMLHttpRequest by nature, not by design.
AJAX will kill itself (Score:1)
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 applica
Ajax draw backs... (Score:1)
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.
Re: (Score:2)
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 cli
Re: (Score:1)
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?
Re: (Score:2)
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.
A
Re: (Score:1)
You now have your nicely formatted slashdot rss feed displayed on t
AJAX still uses a HTTP request (Score:1)
'Oh, AJAX is cool, saves people having to wait for pages to load.' The content has got to come from sonewhere.
Microsoft's OWA most popular AJAX (Score:1)
Try the XForms standards-compliant AJAX (Score:3, Insightful)
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 [graflex.org]
And for completness, I was an editor of an earlier version of the W3C XForms recommendation.
Re: (Score:2)
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
390 pages and 16 chapters? (Score:1)
Here is my test example, it is synchronous and it uses an evaluated array instead of XML, but those concepts can be explained in just another example of the same length:
<HTML><SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function handleHTTPResponseForArray(str) {
handleHTTPResponse(str);
Re: (Score:1)
Re: (Score:2, Interesting)
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
Re: (Score:2)
Google? (Score:4, Insightful)
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.
Re: (Score:1, Funny)
Re: (Score:1, Funny)
Re: (Score:1)
Re: (Score:2)
Re: (Score:2)
You can do very cool Ajax stuff in ASP.NET relatively easily with 3rd party controls from companies such as:
http://www.telerik.com/ [telerik.com]
http://www.componentart.com/ [componentart.com]
and others.
Re: (Score:2)
Re: (Score:1)
Really? Uh oh! Somebody better tell Google they need to redo all their apps in Flash, or they'll fail big time!
The Latest Greatest Buzzword (Score:2)
You email your mother with that keyboard?
Re: (Score:1)
AJAX and Flash have a lot in common... (Score:1)
Re: (Score:2)
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?
Re: (Score:2)
transaction for each letter increment! Totally 'two dot O'
http://www.flapjax-lang.org/demos/letter-count/ru
Re: (Score:2)