Foundations of Ajax
Craig Maloney writes "You've no doubt heard about Ajax. Practically every new and exciting application on the web uses some form of Ajax. Google's suite of applications (GMail, Google Maps, etc.), Amazon's A9 search engine, and Netflix use Ajax interfaces to give the user a better browsing experience. By using some pretty basic innovations to current technology, browsers can now deliver content in ways unimaginable only a few short years ago. Foundations of Ajax provides developers who haven't taken the time to look into Ajax a hands-on guide for quickly leveraging these technologies in their own applications." Read on for Craig's review.
Foundations of Ajax
author
Ryan Asleson and Nathaniel T. Schutta
pages
273
publisher
Apress
rating
8/10
reviewer
Craig Maloney
ISBN
summary
A good first-look at Ajax and client-side development using JavaScript, HTML, and CSS.
Foundations of Ajax starts with a brief history of interactive web-applications, starting from the crudest CGI and Java Applets, and chronicling various interactive technologies (Javascript, Servelets, ASP, PHP, Flash, DHTML, and the various XML browser languages like XUL, XAMJ, etc.). Ajax seems like another acronym in a sea of acronyms, but the authors quickly point out why Ajax can help with the development cycle. Ajax allows the server to validate the user's input, without creating ugly and messy JavaScript validation rules, and it allows the server to use the same rules for input validation on both the client and the server. Unfortunately, Ajax does break some of the conventions users have grown accustomed to in using traditional web applications. XMLHTTPRequest requests aren't stored in the browser history, and it can be confusing to the user to determine what changed on the page after refresh. Issues aside, the book is very encouraging on the prospects of using Ajax in web applications, and invites the reader to use Ajax where it makes sense.
Chapter 2 talks about the request method that makes Ajax possible: XMLHTTPRequest (XHR). The XHR methods are explained with several examples that detail the fundamentals occurring with the request. The examples are very clear, and the entire process is laid out in careful detail, although the Dynamic Object Model (DOM) is mentioned, but not explained until the end of the chapter.
Chapter 3 delves into server communication. It's interesting to note that the authors haven't instantiated a server yet for their Ajax communication, and for the balance of chapter 3, the server is replaced by text files. It's not until the GET/POST examples that the authors start using Servelets. While it may seem strange for the authors to be talking about client/server programming without instantiating a server, it does allow the developer to get their proverbial feet wet without battling server configuration issues. The chapter starts by introducing innerHTML, but then moves to using XML DOM for data transfer from the client. From there, the authors demonstrate a few examples of the server sending XML to the client, and the client sending XML to the server. Happily, the authors weren't content to leave us parsing XML using JavaScript, instead they finish up the chapter by introducing the JSON framework with a few examples.
Chapter 4 is really where the book starts doing very interesting examples with Ajax. It's also, coincidentally, the largest chapter in the book, and the chapter readers will find the most useful reference examples. The book steps through the creation of examples of Simple date validation, Reading response headers for a simple ping application, Dynamically Loading List Boxes, Automatically Refreshing Pages, Progress bar (a personal favorite), Tool tips, Accessing Web Services using REST, and Auto complete. Each example is introduced with a real-world working application as an example (such as the auto complete feature of the Google search engine), and could easily be implemented in a developer's application. I found myself thinking of ways to enhance my code using these techniques.
Following chapter 4's examples, the chapters on creating a developer toolbox, testing scripts using JsUnit, and debugging Javascript seem a bit of a let-down. Chapter 5 outlines various packages for helping JavaScript coders to better spot errors in their code, and create documentation using the JavaDoc-like application JSDoc. There is also a mention of an application for crunching and compressing JavaScript code, as well as the excellent Web Developer Extension. Rounding out the chapter is a brief history of JavaScript, and some advanced JavaScript techniques. Chapter 6 introduces JsUnit and Unit Testing. Chapter 7 talks about JavaScript debuggers, such as Microsoft's Script Debugger, and the very powerful Venkman. The Venkman tutorial is very good, and would be a great starting point for anyone wanting more information on how to use this great tool.
Chapter 8 rounds out the book with the typical "for more information" sites to visit. However, in true Steve Jobs "One more thing" fashion, the authors not only plug their Ajax Framework, but also create a browser-based, Macintosh-like Dashboard application with four widgets. I was all set to finish the book, but the authors quietly slipped the best for last in the final pages of the book, bringing out a complete Mac OSX-like "Dashboard" windowed-environment in a browser complete with the drag-and-drop elements I've most associated with Ajax sites. This is by far the most complicated project in the book, and it make for an excellent ending to an already fine book.
Foundations of Ajax is a great starting point for developers wondering how they can incorporate Ajax into their own web-based projects. One minor gripe I had with this book was the examples looked pale in comparison with their real-world models, but design is hardly the focus of the book. Where Foundations of Ajax shines is it's no-nonsense introduction, implementation, and expansion of the basics of Ajax programming, leaving the reader confidently ready to utilize the concepts within. The authors have seen the potential of Ajax, and competently convey their expertise and enthusiasm for this technology."
You can purchase Foundations of Ajax from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Foundations of Ajax starts with a brief history of interactive web-applications, starting from the crudest CGI and Java Applets, and chronicling various interactive technologies (Javascript, Servelets, ASP, PHP, Flash, DHTML, and the various XML browser languages like XUL, XAMJ, etc.). Ajax seems like another acronym in a sea of acronyms, but the authors quickly point out why Ajax can help with the development cycle. Ajax allows the server to validate the user's input, without creating ugly and messy JavaScript validation rules, and it allows the server to use the same rules for input validation on both the client and the server. Unfortunately, Ajax does break some of the conventions users have grown accustomed to in using traditional web applications. XMLHTTPRequest requests aren't stored in the browser history, and it can be confusing to the user to determine what changed on the page after refresh. Issues aside, the book is very encouraging on the prospects of using Ajax in web applications, and invites the reader to use Ajax where it makes sense.
Chapter 2 talks about the request method that makes Ajax possible: XMLHTTPRequest (XHR). The XHR methods are explained with several examples that detail the fundamentals occurring with the request. The examples are very clear, and the entire process is laid out in careful detail, although the Dynamic Object Model (DOM) is mentioned, but not explained until the end of the chapter.
Chapter 3 delves into server communication. It's interesting to note that the authors haven't instantiated a server yet for their Ajax communication, and for the balance of chapter 3, the server is replaced by text files. It's not until the GET/POST examples that the authors start using Servelets. While it may seem strange for the authors to be talking about client/server programming without instantiating a server, it does allow the developer to get their proverbial feet wet without battling server configuration issues. The chapter starts by introducing innerHTML, but then moves to using XML DOM for data transfer from the client. From there, the authors demonstrate a few examples of the server sending XML to the client, and the client sending XML to the server. Happily, the authors weren't content to leave us parsing XML using JavaScript, instead they finish up the chapter by introducing the JSON framework with a few examples.
Chapter 4 is really where the book starts doing very interesting examples with Ajax. It's also, coincidentally, the largest chapter in the book, and the chapter readers will find the most useful reference examples. The book steps through the creation of examples of Simple date validation, Reading response headers for a simple ping application, Dynamically Loading List Boxes, Automatically Refreshing Pages, Progress bar (a personal favorite), Tool tips, Accessing Web Services using REST, and Auto complete. Each example is introduced with a real-world working application as an example (such as the auto complete feature of the Google search engine), and could easily be implemented in a developer's application. I found myself thinking of ways to enhance my code using these techniques.
Following chapter 4's examples, the chapters on creating a developer toolbox, testing scripts using JsUnit, and debugging Javascript seem a bit of a let-down. Chapter 5 outlines various packages for helping JavaScript coders to better spot errors in their code, and create documentation using the JavaDoc-like application JSDoc. There is also a mention of an application for crunching and compressing JavaScript code, as well as the excellent Web Developer Extension. Rounding out the chapter is a brief history of JavaScript, and some advanced JavaScript techniques. Chapter 6 introduces JsUnit and Unit Testing. Chapter 7 talks about JavaScript debuggers, such as Microsoft's Script Debugger, and the very powerful Venkman. The Venkman tutorial is very good, and would be a great starting point for anyone wanting more information on how to use this great tool.
Chapter 8 rounds out the book with the typical "for more information" sites to visit. However, in true Steve Jobs "One more thing" fashion, the authors not only plug their Ajax Framework, but also create a browser-based, Macintosh-like Dashboard application with four widgets. I was all set to finish the book, but the authors quietly slipped the best for last in the final pages of the book, bringing out a complete Mac OSX-like "Dashboard" windowed-environment in a browser complete with the drag-and-drop elements I've most associated with Ajax sites. This is by far the most complicated project in the book, and it make for an excellent ending to an already fine book.
Foundations of Ajax is a great starting point for developers wondering how they can incorporate Ajax into their own web-based projects. One minor gripe I had with this book was the examples looked pale in comparison with their real-world models, but design is hardly the focus of the book. Where Foundations of Ajax shines is it's no-nonsense introduction, implementation, and expansion of the basics of Ajax programming, leaving the reader confidently ready to utilize the concepts within. The authors have seen the potential of Ajax, and competently convey their expertise and enthusiasm for this technology."
You can purchase Foundations of Ajax from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Not even one mention of "Web 2.0"!
could someone kindly link a page that demos ajax's features?
While I appreciate this review, is the book really neccessary? AJAX moves very quickly, with new/better examples popping up everyday. Maybe it's me but I find less of a need for technical books and magazines since I can get all of my information from the internet. The personal example I'll use is Sys Admin; great magazine but I haven't leanred much from it during the last year. If I want to learn a specific server app or hack it's just easier and more up to date to grep it online.
fak3r.com
So, is there an IDE like Visual Studio for AJAX, or are we expected to wade through pages of HTML and Javascript like in the old days of the web? In my opinion, GUI applications are best developed inside GUI applications.
Religion for nerds. Stuff that really matters
I feel sorry for all the trees that have to be cut down needlessly so that developers can try to keep up with the latest crappy technology that will obsolete in less than 2 years.
On the bright side, at least its under 300 pages long.
I know PHP/Javascript/HTML relitivly well. Do you think this book would be an easy read for me. Or would I really have to sit down and try. Heh, got the book for christmas and just looking for time to read it.
I have actually read/worked through this book and indeed it was not only one of the first books on Ajax but also one of the better books on Ajax. Some of the portions are now a little outdated, like the discussion on frameworks, but these areas can easily be filled in with a little research on the Internet.
FREE - Java, J2EE and Ajax Audiobooks for Software Developers - www.DeveloperAdvantage.com
The lumber industry, paper mills, and O'Reilly publishing are all it together! Create a new programming language and Presto! More revenue for all!
Saturday is April 1. Slashdot will be shut down. Sorry for the inconvenience.
Like, this one, perhaps.
Some of you might be interested in a recent Presentation / Screencast given by Kevin Dangoor (creator of the TurboGears Python web framework) given at this year's Pycon. Although he does talk a bit about TurboGears, most of the talk is tips and examples on how to add functionality using Ajax without confusing users.
I've been trying to see if there was a website for the language, you know like Perl, PHP, etc.... This is what I found: A political site?
Saturday is April 1. Slashdot will be shut down. Sorry for the inconvenience.
i've used that method and it will never be as popular as AJAX, because AJAX leverages everyone's love for XML. really it seems to work just the same, with the server sending javascript code and data structures instead of XML. be sure to add a random querystring value to the script call, or else you're going to get some monstrous caching issues :)
But is something going on with the moderator points? Or is it just a slow day (or three)?
I noticed all the stories have very few comments modded to 3 or above. And by few I mean 20. Just skip through any of the articles on the front page.
Did I not get the memo?
[Fuck Beta]
o0t!
Interesting idea.
I'll be sure to give this a try.
...InstantRails makes it easy to get it up and running, and Rails definitely has AJAX support built in.
I'm using AJAX a fair bit (mostly on the admin pages) on getindi; it's very handy stuff!
The Army reading list
I would like to see an application that can work online and offline with same ease. We, at my firm, had tried an app using java which worked standalone when network was loaded and became online when there was less congestion. Our internal network was so slow that the application was standalone most of the time. That was India and year was 2000. Now Ajax looks like a good solution for a long forgotten problem.
"... deliver content in ways unimaginable only a few short years ago"
but, but, I remember imagining it. I remember it all over the tech press... and those guys that wrote the technology, they -imagined- it! For GOD'S SAKE WE ALL IMAGINE THAT SHIT!!!!
-pyrrho
There is supposedly going to be an eclipse plugin. http://www.eclipse.org/proposals/atf/
All "Ajax" means is that Javascript now works. I used to accomplish the same tasks (i.e. asynchronously send/receive bits of data, dynamically update tables without refreshing the whole page) using hidden frames and javascript submits back in 1999. Javascript now has built-in functions to do this so it's less of a hack, but I don't think that it merits a whole new buzzword.
Then again, I guess it's something for new startups to tout and investors to latch on to, so maybe it's more of a business/marketing buzzword than a software/technology buzzword.
There are 2 kinds of people in this world. Those that can keep their train of thought,
I think there's two reasons why people are so excited about Ajax. The first reason people are so excited about Ajax is because it doesn't require anything extra to make it work. Flash requires not only the plugin (which admittedly is pretty ubiquitous out there), but also requires a development package that isn't cross platform (at least I'm not aware if there's a Linux version of the development tools). Ajax allows the neat features to come through without having to resort to Flash. The second reason Ajax has caught on is server-side validation rules can also work on the client. One set of rules = no more trying to wrestle Javascript to do proper validation. For me, that's a huge win, as I'm no fan of Javascript.
I want to use it.
Damn marketing driods
Mod me down with all of your hatred and your journey towards the dark side will be complete!
I picked this book up on my last trip to Vegas. I read it cover to cover. I found it to be on the elemtary side of the AJAX discussion. I was disappointed when I found most of the content, code examples and demos can be found online in different places. AJAX is just a hot topic right now, I find this book as an attempt to ride the coat tails of the AJAX phenom.
I have this book. It's a pretty straightforward introduction to the topic. The central problem with it is that all the examples that use server-side components only use Java.
If you use Java, great. But the book title is misleading, and it should be called "Foundations of Ajax in JavaScript and Java."
The other caveat: the book is designed for people who want to use Ajax to spruce up an existing web page a little, not design new applications built from the ground up to use Ajax as the data transport mechanism. If this meets your needs, great. If you're looking to do bigger stuff, get "Ajax in Action" froom Manning.
I also recommend that you check out the Gecko DOM Reference. It's a great, handy online resource which I've consulted frequently as of late for many DHTML apps and functionality.
I only post comments when someone on the internet is wrong.
Is it good or is it wack?
All's true that is mistrusted
Actually, that's not true. The load() method was part of early DOM3LS drafts, but was taken out before the specification reached Recommendation status. As far as I'm aware, there's no non-draft specification describing load(), nor plans to write one.
XMLHttpRequest, on the other hand, is part of the draft "HTML 5" specification published by the WHATWG, and I expect it will remain there permanently.
Bogtha Bogtha Bogtha
Your premise - that developing Ajax web applications is harder than developing Flash applications - doesn't support your conclusion - that Flash is technically better.
You are assuming that Ajax web applications and Flash applications are of a similar quality - they are not. Flash applications are essentially executables that you are handed, with no choice but to run them or not run them. Web applications are documents linked together, with stylesheets to suggest a presentation and script to suggest an interaction model.
These two approaches are totally different. As a user-agent not only understands the final product, but the individual components that a web application is comprised of, it has much better opportunity to work with those components. This means that browser features that users are used to and expect to work do not break. There's a wide range of browser features that are broken in Flash applications that are not (necessarily) broken in Ajax web applications:
If you think that it's easier to develop something in Flash, then fine. But don't pretend that what you end up with is of equal quality. You end up with something very different to a web application, so whether the quality is higher or lower depends on your particular circumstances, and cannot be generalised to the extent that you do.
Bogtha Bogtha Bogtha
Too bad that "the source" is a very poorly structured website IMO where I can never find what I want. I guess I just didn't try hard enough, but I couldn't find a comparable page at W3 as the DOM index I linked at Mozilla.org. I don't want to know the fucking history, recommendations, all that bullshit. I want real information that I can take and use, right now. Where's the "pocket reference" pages?
Am I the only one who thinks it's difficult to use the W3 site as a general programmer's reference for anything at all? Whenever I think to myself, "Gee, I'd like to do this the right way, and conform to W3 'standards'", I get lost at W3 and go elsewhere for the Cliff's Notes version.
I only post comments when someone on the internet is wrong.
I think it is more like, when using AJAX, user interfaces are slowly creeping back up to where they were 10 years ago, before everything was crippled to work as a web form in the lowest common denominator browser. Web interfaces still have a hell of a long way to go before they are even close to the level of sophistication that rich clients were at 10+ years ago. Everything that is new was old once before.
The slashdote code base is too old but, there closest competitor uses it! According to this digg has almost the same traffic as slashdot.
Yes, and if web applications were made up of nothing but Javascript, then you might have a point. But they are not. Javascript is just one non-essential component.
Flash vulnerabilities certainly exist.
It seems you've assumed that my problem with it being a chunk of executable code is one of security. This is not the case. Given executable code, you've really only got two options - run it or don't run it. Given a series of documents in a well-understood format, with a bit of executable code on top, you can do all sorts of things without having to execute the code.
Tim Berners-Lee described this as the Principle of Least Power, and he was spot on. When you decompose something into simpler pieces that can stand alone, you enable greater functionality. Separating the content from the presentation from the behaviour, like HTML, CSS and Javascript do, it means there's a very low barrier to entry for manipulating that content. When you bundle it all back up like Flash does, it means there's a much higher barrier to entry.
This is not true. All the things I list are browser features that work in Ajax web applications because they build on the browser's basic data formats. All the things I list break in Flash because Flash throws away the browser's basic data formats and uses its own.
You could replicate similar features in your Flash applications, and many people have made various attempts over the years, but they are always cheap knock-offs that never work quite right.
For example, when a link is clicked with the middle mouse button, what should your Flash emulation of my browser feature do? In Firefox on my workstation, that should open in a new window. In Safari on my laptop, that should open in a new tab. If I'm in Windows, it should switch on autoscrolling. What is your Flash application going to do? If it does anything, it's going to be wrong in two out of three cases, and if it does nothing, then it's going to be wrong in all cases. Meanwhile, an Ajax web application works perfectly because the link is a normal HTML link that the browser understands, rather than a viewport into an external application that it has no understanding of.
Yes, it's possible to break such things in Ajax web applications, but they work by default with no extra code. But it's impossible for Flash applications to work correctly in this way.
Yes, but my point is that Greasemonkey doesn't work. Greasemonkey works with Ajax applications because they are using the browser's native formats and objects, not ignoring them. And a thousand other extensions are exactly the same. And extensions that will be dreamt up next week and implemented a month from now will be the same. Are you going to anticipate all of these extensions and features and build them into your Flash application as well?
This isn't about one particular feature. This is about features in general being built to work with the web, and breaking because Flash ignores everything that has gone before it. It builds a slick little presentation layer into a viewport that is only accessible in a web browser because that's the most convenient way for Macromedia to deliver Flash applications to people.
Bogtha Bogtha Bogtha
Even really busy threads like the Vista wont suck had really few comments modded up. I think it has been just the last couple days too
Some very simple samples but with understandable code, just go to
http://wyoguide.sourceforge.net/test/tree1.html
http://wyoguide.sourceforge.net/test/tree2.html
http://wyoguide.sourceforge.net/test/tree3.html
http://wyoguide.sourceforge.net/test/tree4.html
try them out and view the source. For more info go to http://dojotoolkit.org/
O. Wyss
See http://wyoguide.sf.net/papers/Cross-platform.html
Because the Slashdot community already suffers from enough "bleeding edge" technology as it is. Besides, there's no Perl in AJAX. :P
Dynamic Object Model!?
I code, therefore I am.
It is offtopic, but it is the first comment I've read wondering what is going on. I've noticed this as well. Have fewer users been given moderator status lately or something?
If that's what it comes to, why not just stick with Flash? At least with Flash, it doesn't take a dozen images and pages of CSS to effect a rounded rectangle! (This may be an exaggeration!)
Steven N. Severinghaus
Flash is pretty much a way of embedding an executable in a browser. AJAX is a buzzword for using javascript to manipulate the layout and contents of a page; the two are not directly interchangable.
If I were to be given a choice, I'd develop in Flash over "AJAX" any day. No issues with browser sniffing, cross-browser glitches, or the debugging hell that comes bundled with complex javascript apps. But there are some things you can do with javascript that you simply cannot do with Flash. And there are degrees of "AJAX" - in a number of my sites I've used a single call to XmlHTTPRequest to send data contained in a page to the server without changing the page the user is on. Trying to fulfil that requirement by redeveloping the whole site in Flash is overkill.
Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
If this were true, then browsers like Lynx, JAWS and IBM Homepage Reader would be impossible. Content and presentation are clearly not bound together as tightly as you claim.
You might consider HTML to be a poor data format, but that doesn't change the fact that it's as close to a native format for the web as there is, with practically everything on the web hooking into it in some way. The same can not be said of Flash.
That's so vague as to be meaningless. An HTML element means the same thing regardless of whether people develop everything independently or not. The meaning of HTML element types are defined in the HTML specifications. Can you clarify what you meant here?
This makes no sense. Web services are a way of accessing and manipulating data on the server. Greasemonkey is a method of accessing and manpulating the data in the browser. They are solutions to totally different problems. You can't do the things Greasemonkey does with web services and you can't do the things web services do with Greasemonkey.
Wrong.
No, some web applications do that, because there are a lot of clueless web developers around. The problem isn't caused by Ajax, it's caused by web developers who don't know what they are doing.
When you say "all the links make Javascript function calls", that's simply not true. Ajax is a method for communicating with the server. Depending on the application, it might not involve links at all. Even if it does, the correct way of handling that is to provide a normal HTML link, and hook into the onlick handler. "Broken by default" is plain wrong because if there is such a thing as "default" with Ajax, it would be a plain HTML link.
GMail sucks. Look through my posting history, you'll see I've posted your exact complaint about GMail's links before. Don't assume that because GMail is fucked up that everything using Ajax is fucked up too. Google are very good at interfaces, very good at server-side architecture, and astoundingly bad at writing HTML, CSS and Javascript. The problem you are seeing with GMail wasn't caused by Ajax, it was caused by a Google developer screwing up.
Like I said, with Ajax web applications it's possible that things can be broken (as with anything), but with Flash, it's a given.
Simply wrong. Anybody the least bit familiar with Javascript knows that you just have to return true from the click handler to have the browser's default behaviour kick in. And you only have to do that if you hook up a click event in the first place.
No, it doesn't, because it work
Bogtha Bogtha Bogtha
[Fuck Beta]
o0t!
As I'm sure you all know, testing AJAX stuff in multiple browsers is really important if you want to guarantee cross-browser compatibility; it's also really tedious. JsUnit seemed like it would be a promising tool for AJAX automation.
In fact, I'm sad to say, JsUnit can't be used to validate AJAX components at all; in fact, it can't it be used to validate *any* command that requires a callback, including XmlHttpRequest, event handlers, pop-up windows, etc.
This is because browsers (IE/Firefox both) interpret JavaScript in a single thread, but actions you perform may have asynchronous side effects OUTSIDE of your own thread. So when you attempt one of those fancy asynchronous XmlHttpRequests, you can't just sleep/wait until your request finishes, because it will *never* finish until you completely return from your current thread. Only then will the interpreter begin working on the next item in the event queue.
That means, among other things, that it's impossible to wrap an AJAX request in a "try/catch" block:Because this will never work, JsUnit's strategy of emulating JUnit or the other *Unit frameworks is fundamentally unsuitable for testing AJAX in multiple browsers.
If you *are* interested in testing AJAX applications in multiple browsers, I recommend looking into Selenium, which basically works around the problem by constantly scheduling timers to re-invoke itself every 10ms... that gives the interpreter enough time to do other work, and allows Selenium to implement a simple "pause" action that actually works.
When I moderate, I only use "-1, Overrated". That way, I never get meta-moderated!
And the "script injection" method IS standard-compilant as far as you believe in standards. Thing is "standards" don't equal to "perfection", standards have their own errors too.
Standard specifies you're allowed to insert any DOM element at will, and makes no special exceptions for "script." It makes lots of assertions about cross-window, cross-frame etc scripting, about limits of what can you do with elements inherited by inserted elements etc, but in normal conditions you're free to load a script from an arbitrary site, and there are no assertions making inserting DOM elements anything "not normal".
It's abusing a hole in the specs, because "script" elements should be treated differently than others and follow different rules when created upon document creation than when inserted through DOM methods - but there are no exceptions and inserting a script is just the same as inserting anything else. The browser support is there (MSIE requires "DEFER", but that's about all). Specs say "all elements" and make no exception. So let's live happily and use the godsent feature not caring that it's a bug.
Anagram("United States of America") == "Dine out, taste a Mac, fries"
Sure, AJAX is great for certain applications and under certain conditions, but there are always a few downsides / problems. Check out the blog entry by Harry Fuecks for some links to good presentations describing the negative aspects of AJAX.
I don't know about the book, but If you use DOM based javascript, the browser compatibility issues all but disappear. I'm writing an AJAX based multiplayer RPG using php and javascript, and, if I remember correctly, the ONLY bit of code I had to write for different browsers was for keypress events.
Incidentally, you are correct in that AJAX allows you to move a signifigant portion of your logic to the server and avoid some javascripts shortcomings.
Yeah, but no built in support for errors or callbacks.
// This is not a sig.
As a user of Yahoo's mail beta, which seems to be based on Ajax, I was enthusiastic. But! such are the delays inherent in the current incarnation of the Web, that this approach is much hyped and absolutely doomed to failure. Contrast Google Earth with Ajax stuff. It is absolutely almost impossible to use. I gave up on it. Memo: the Internet is "best effort", which means that delays are unpredictable. You cannot put this in a GUI loop.
...but, unlike Ajax, Web 2.0 is not STD (Stronger Than Dirt!).
Wha? I happily admit that we've seen some pretty cool uses of the available technology in recent times, but I've personally been doing what is now known as Ajax for at least 5 years.
Would people please stop taking all the fun arcane stuff and wrapping up in media-friendly (and code monkey friendly) parcels?
Now a good chunk of my fun work will be replaced by some company's "Ajax Framework", just like web services and HTTP replaced roll-your-own network protocols, and Windows replaced custom GUIs.
I redeclare your name to be "Smacktard".
This is a joke. I am joking. Joke joke joke.
The problem with using bugs.... is that bugs get fixed. (Sometimes)
...What? Google Earth is impossible to use? My 15 year old brother doesn't seem to have any problem using it quite fluidly. AJAX is doomed to failure? Its been in use for over 5 years... which is a pretty good chunk of time considering the age of the internet.
depends if your javascript code is inlined or in a its own file. If it's inlined, the "proper" solution is to put it in a CDATA section.
Do you even lift?
These aren't the 'roids you're looking for.
Except javascript, XMLHTTPRequest support and cross-platform scripting to handle IE DOM wackiness.
Sure, you can gracefully degrade, but Flash is just as ubiquitous and works the same everywhere.
Do you even lift?
These aren't the 'roids you're looking for.
No... you could have a timeout error (I think gmail does), but you're not interacting at a low enough level to know if the data was received and processed. (in this case, if the email message was actually sent). That problem is the same with forms and cgi though.
Do you even lift?
These aren't the 'roids you're looking for.
It's
There's no such method as
in DOM (which, contrary to what the reviewer says, stands for Document Object Model, not Dynamic Object Model).
Using HTML in email is like putting sound effects on your phone calls. Just say <strong>no</strong>.
Um... as far as I believe in them? Is their existence in question?
That's your opinion. But how is it "abusing a hole in the specs" to do something according to spec and have it work according to spec? <script> elements contain Javascript that is parsed and executed, you add a <script> element and it is parsed and executed... seems fairly straightforward to me.
You might argue that it shouldn't do that, but the spec doesn't say that it shouldn't be done, you say that. And with all due respect, your opinion is hardly normative.
It works exactly as it's supposed to. That's not a bug.
Bogtha Bogtha Bogtha
So then what does Chinese Pi taste like?
Do you believe in Apocrypha? Apocrypha exist.
you add a script element and it is parsed and executed... seems fairly straightforward to me.
Except the specs came to lengths to prevent this kind of behaviour in cross-domain linking. You can't perform xmlHTTPRequest for a website other than the one the page is loaded from. You can't do shit to a DOM tree of a document in other frame/window. The specs' intention of preventing ability to dynamically load scripts from sites other than where the page comes from seems obvious. You can statically include a "foreign" script upon loading the webpage and then that's the end. You can't change src of existing script. (actually you can, but the new script won't load), you can't perform live request to download XML data. You can't access data or scripts in frames you've dynamically (or statically) loaded. There's a lot of safeguards against cross-domain scripting. But inserting a new "Script" element isn't protected in any way and you can do far more serious changes to the page (document, scripts, browser settings etc) using it, than you would if cross-site xmlHTTPRequest was legal.
It works exactly as it's supposed to. That's not a bug.
So disabling/limiting cross-frame scripting, cross-site scripting, preventing loading data from other sites, these all are bugs then? Because they stand in direct opposition of this idea. It's a gaping hole in what they try to prevent.
Anagram("United States of America") == "Dine out, taste a Mac, fries"
AJAX isn't bleeding edge, and even if it was, the slashdot site itself is the farthest thing from it. It's legacy.
And the server-side part of AJAX can certainly be Perl.
Don't thank God, thank a doctor!
Please be more clear. This is the second time you've skirted around what you are trying to say here without coming out and saying it.
So? There's a huge difference between XMLHttpRequest, iframes, etc, and dynamically added Javascript - iframes, XMLHttpRequest, etc, can access content. You can post forms in iframes and with XMLHttpRequest, so you can take action on behalf of your visitor if cross-site scripting was allowed here. You can access whatever information your visitor can access if cross-site scripting was allowed for XMLHttpRequest and iframes.
Dynamically added <script> elements can't do either of these things. You might as well claim that dynamically added <img> elements are a mistake because they can access things on other domains.
You've misunderstood the purpose of the specs in preventing cross-site scripting. It's not to protect the site that is doing the inclusion, it's to protect the visitor and the site that is being included. The fact that a script is able to include another script that can drastically alter the page is outside the scope of the cross-site scripting protection that the specs provide. It's a fundamentally different thing.
I fail to see why you are making the distinction between dynamically added <script> elements and static <script elements anyway. Either way, they've got to be added by the site owner, and either way they are just as powerful. It seems more like you are looking for an excuse to label dynamically added external scripts as wrong rather than anything else.
Bogtha Bogtha Bogtha
Save yourself $5.60 by buying the book here: Foundations of Ajax [amazon.com].
Muchos gracias.
And if you use the "secret" A9.com discount [amazon.com], you can save an extra 1.57%!
Appreciated, but...
from A9: You can save an additional 1.57% (/2%) on virtually all your purchases at Amazon.com by simply becoming a regular user of our search engine at A9.com and on A9.com. Once you use A9.com for a few days you will be eligible for the A9 Instant Reward.
I'm not so easily bribed... at least not for a measily 1.57%. And even if I was, the patheticness factor of this 'marketing' scheme would outweigh the savings anyway.
Flying is easy, just throw yourself at the ground and miss. -Douglas Adams