5 ms·
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!
- amichail 18y agoTry Google's GWT.
- bprater 18y agoIf you are familiar with web programming today, Ajax isn't a tough technology to master. There are hundreds of simple frameworks you can start with. Grab any of them, find a simple tutorial and start tooling around. The 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!
- amichail 18y agoThe problem though is that AJAX app development is a mess (e.g., in terms of dealing with compatibility issues across browsers and different versions of the same browser, using the slow minimal dynamic language Javascript, poor tool support, etc). At least Google's GWT tries to clean up a bit of this mess. A better way to go in the future might be to use Silverlight.
- axod 18y agoIt's really not. Compatibility issues are seriously way way over-hyped.
- breily 18y agohttp://www.w3schools.com/Ajax/Default.Asp http://www.w3schools.com/Ajax/Default.Asp 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 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.
- Frocer 18y agoThanks. 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
- morbidkk 18y agowhy dont you get hold of any of these books 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
- jrockway 18y agoPrototype is really a horrible framework. It works by adding methods to every class in the language, even when they don't make sense. This makes for a bit of syntactic sugar, but it also ensures that you can't use other frameworks and that custom code might become very hard to debug. For your own sake, use anything else.
- sc 18y agoLayering frameworks probably isn't a good idea to begin with. Prototype does seem, unfortunately, more powerful than jQuery, though, when it comes to class creation.
- jsdalton 18y agoTry jquery. 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.
- menloparkbum 18y ago+1 for jquery, and for the comment suggesting the javascript book. Javascript and DOM quirks are probably the biggest stumbling blocks if you are already a decent programmer. Douglas Crockford's videos are also worth watching, if you have the time. http://developer.yahoo.com/yui/theater/ http://developer.yahoo.com/yui/theater/
- tlrobinson 18y ago+1 for Crockford's lectures. And his website: http://www.crockford.com/javascript/ http://www.crockford.com/javascript/ 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.
- wenbert 18y agoI agree with jQuery. I dove into ajax a few years back using core JS. Then my friend recommend jQuery. Whatever it is that you are trying to do using core JS, jQuery should be able to handle it. jQuery is fast, and makes your code really short. I suggest you go straight to jQuery and save time. You will eventually "get" the fundamentals once you get the hang of it. i recommend visualjquery.com
- wheels 18y agoI found myself asking the same question as the poster a couple weeks back. I ended up starting with Dojo, which I was surprised to see didn't get a mention here at all, rather than jQuery. Out of curiosity, did anyone here compare the two and choose jQuery or is jQuery just more established?
- 18y ago
- jrockway 18y agoThe other comments in the thread seem to tell you to use a framework, and that's great advice. But you need to learn plain javascript first. You say you've mostly done PHP, so there are some programming concepts that are essential in javascript that you haven't been exposed to, namely functional programming. So, learn a bit about functional programming, then get a javascript book (the oreilly one is good), and read that. Then you'll know the basics and can use a framework to abstract away some of the tedium.
- amichail 18y agoNo, you can just use Java with GWT.
- Bluem00 18y agoI really liked the book "Pragmatic Ajax: A Web 2.0 Primer" (http://www.amazon.com/Pragmatic-Ajax-Web-2-0-Primer/dp/0976694085/ref=sr_1_1?ie=UTF8&s=books&qid=1209355518&sr=8-1 http://www.amazon.com/Pragmatic-Ajax-Web-2-0-Primer/dp/09766...) It provides an overview of the more popular frameworks, and explains the ideas behind rich web interaction (and Google Maps in particular).
- rms 18y agostart with javascript...
- rshao 18y agoI agree. JavaScript is a pretty crucial step before really tapping into AJAX, particularly if you want to execute scripts you retrieve via AJAX. I'm not sure if any script packages have that. Also, I find it useful to work from scratch, particularly for client-side stuff like CSS and JavaScript, so your users load the page faster.
- tlrobinson 18y agoI can't tell, are you being sarcastic? You realize AJAX is just a fancy name for using JavaScript to load content dynamically?
- SwellJoe 18y agoIf you don't already know JavaScript, and probably even if you do, Douglas Crockford's videos are awesome. He also covers the DOM, which is intrinsic to working with AJAX. http://developer.yahoo.com/yui/theater/ 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.
- menloparkbum 18y agoOh yeah, +1 Firebug. You need Firebug. Figuring out WTF is going on is nearly impossible without it, unless you're a masochist and enjoy debugging via alert dialogs.
- wenbert 18y agoand yes, Firebug is a must. the "Inspect" feature is FTW
- deleted 18y ago[deleted]
- tlrobinson 18y agoIf you already know Javascript, all you need to become buzzword compliant is this: http://developer.apple.com/internet/webcontent/xmlhttpreq.html http://developer.apple.com/internet/webcontent/xmlhttpreq.ht...
- pfisch 18y agoWhatever you do do not under any circumstances use plain javascript. It will not work at all in IE. Isn't it ridiculous that javascript is not even functional as a language unless you extend it with a framework? I advise prototype.
- axod 18y agoWhat??? That makes absolutely no sense. Javascript works just fine in IE.
- mxh 18y agohttp://www.ibm.com/developerworks/views/web/libraryview.jsp?search_by=Mastering+Ajax http://www.ibm.com/developerworks/views/web/libraryview.jsp?... 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.
- rantfoil 18y agoYou need to learn Javascript before you learn AJAX. AJAX is really a simple set of method calls, the harder part is really understanding DOM manipulation, event handling, etc. 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!
- axod 18y agoInstead of 'ajax' which doesn't really exist, I'd recommend learning javascript. Don't start with a framework or library, just learn the nuts and bolts of the language. 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.
- tokipin 18y agohttp://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX...
- Dylanfm 18y agoI found the book "DOM Scripting" great. There's a brief intro to javascript syntax, then alot of focus on using javascript with the DOM and making sure you do it according to some best practices. The book finishes with an intro to ajax and is followed by a book called "Bulletproof AJAX" by the same bloke. The gracefully degrading and unobtrusive use of javascript is important, and the author of these books preaches it well.
- brk 18y agoLots of good comments here... http://www.miniajax.com http://www.miniajax.com has some cool ajax "widgets" that can help you tackle certain problems with digestible chunks of code.
- iraw 18y agoYou should learn the basics before letting some higher-level framework do all the magic for you. There are some good articles about AJAX on the Mozilla Developer Center: http://developer.mozilla.org/en/docs/AJAX http://developer.mozilla.org/en/docs/AJAX You can begin with http://developer.mozilla.org/en/docs/AJAX:Getting_Started http://developer.mozilla.org/en/docs/AJAX:Getting_Started You can also find some good pointers to AJAX toolkits and examples there.
- JayNeely 18y agoFrocer, I'm in the same position, minus having had a fair amount of programming experience(only a couple of Java classes in college). Would you be up for exchanging IM or other contact info, so we each have someone to bounce things off of as we learn? My e-mail's in my profile, and the offer is open to others as well.
- Frocer 18y agoAbsolutely! I will send you an Email and we can exchange info. I am always looking for people who I can bounce ideas off with :)
- initself 18y agoHead First AJAX by O'Reilly.
- posborne 18y agoThe way I picked up AJAX was by looking of some of the simpler articles on the basics (don't worry about cross-browser to start with) around the web. The basic concept is quite simple and it is easy to get up-and-running if you have experience with client-side and server-side scripting. 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).