Ask HN: Where do I start if I want to learn AJAX?
AJAX has been something I have always wanted to pick up, but not sure where to begin. I am not very familiar with Javascript either. Could you please recommend any online tutorials or book that's good for someone new to AJAX?
I have heard AJAX is really hard to pickup without using an existing framework, is that really the case? If it is, which framework should I begin with? (I actually find that a bit hard to believe, and really want to learn the fundamentals)
I have a fair amount of programming experience. Web development experience is primarily with php/sql, if that helps with any suggestions :)
Thanks in advance!
39 comments
[ 73.9 ms ] story [ 259 ms ] threadThe concept is simple: send and load information without refreshing the webpage. You'll use the same back-end technology. You'll use a smattering of Javascript for the browser. And you'll be in business!
This gives a pretty good introduction at what is actually going on. The framework I've used (Prototype) abstracts away the details (like constructing the XMLHttpRequest) but its always good to know whats going on below the surface.
If you know any python, this link - http://www.willarson.com/blog/?p=36 - is very helpful, it was how I got started. The actual AJAX part of it is the same no matter which server side language you use.
That's exactly what I really wanted to learn -- know what goes on under the surface and how everything interacts, so I could build upon it.
I think I have already went through the w3schools tutorials a while ago. If you come across any others please let me know
1) Pro JavaScript Techniques by John resig
2) Professional JavaScript For Web Developers - Nicholas Zakas
I would recommend these two books to anyone who wants to learn JavaScript and XHR. Ajax is very small part fo the whole picture if you are totally new to javascript
For your own sake, use anything else.
BTW, it's not so much that ajax is "hard" without a framework. The problem is with the varying ways different browsers implement javascript and the DOM. A good framework (like jquery) abstracts away many of these variations and allows you to concentrate on the more interesting hard problems.
He's got a new book coming out soon too. I haven't seen it yet, but I imagine it will be pretty good.
"Javascript: The Definitive Guide" (published by O'Reilly) is a good resource as well.
It provides an overview of the more popular frameworks, and explains the ideas behind rich web interaction (and Google Maps in particular).
http://developer.yahoo.com/yui/theater/
Start with "The JavaScript Programming Language", and then do "Advanced JavaScript" and finally "An Inconvenient API: The Theory of the DOM" (the latter two can stand alone, and if you're in a hurry, maybe get the DOM out of the way). That plus spending some time with Firebug and a few interesting JavaScript applications (and building some of my own) has been the entirety of my JavaScript education. I bought the "Definitive Guide" from O'Reilly, but haven't used it heavily.
There are other useful videos on the same page, including one with Joe Hewitt introducing Firebug. I can't stress enough how helpful Firebug has been in helping me learn JavaScript and AJAX.
Note that I haven't talked much about AJAX. AJAX is a tiny piece of JavaScript, but in order to build useful applications you need to know a lot more than AJAX. So, learn JavaScript and AJAX will come naturally.
As others have mentioned, the good frameworks make dealing with browsers easier, since it hides compatibility issues as well as some of the complexity. Mainly a framework just allows you to spend more time thinking about your specific needs rather than the tedious plumbing work of getting stuff happening on the page.
I advise prototype.
Particularly tutorial 5.
It's a pretty good/quick overview of how all the bits of Ajax (JS, the DOM, XHR, Markup, etc.) work together, along with brief, functional examples. Should get you orientated in a hurry, then you can dive into the various topics as needed.
I highly recommend the Sitepoint books -- "Simply Javascript" and "The Art and Science of Javascript." Between these two books, you get a very step-by-step, approachable tutorial of the basics of what you need to start out with.
They teach you in framework-agnostic way, which is important because you want to be able to write JS without relying heavily on any one framework. In fact, one of the books goes into detail teaching you HOW some frameworks work their magic. It's fascinating.
Good luck!
The incompatibilities between browsers are really really over-hyped, so I'd say using a library isn't worth it. At least until you have a solid understanding of all things javascript.
There are some good articles about AJAX on the Mozilla Developer Center: http://developer.mozilla.org/en/docs/AJAX
You can begin with http://developer.mozilla.org/en/docs/AJAX:Getting_Started
You can also find some good pointers to AJAX toolkits and examples there.
My e-mail's in my profile, and the offer is open to others as well.
For me, the firebug tool for firefox was indispensable as it allows you to see the requests that are being sent out and received from the server, information you have no easy way to get at without such a tool.
Once you are up and running with the basics, the magic of AJAX will no longer be so mysterious and you can move on to one of the frameworks for adding cross-browser compatibility (I like jquery personally).