Introduction To Javascript And Ajax

The World Wide Web officially celebrated its 20th birthday as I began writing this topic. In one sense, it’s hard to believe that the technology has been around this long already. At another level, it’s amazing how much has happened in that short time. When I started teaching and writing about the Internet (long before the Web was practical), none of us had any idea what it was going to turn into one day.
If you’re reading this topic, I don’t have to tell you that the Web is a big deal. It’s come a long way, and it’s doing very interesting things. What I want to show in this topic is where the Web is going. Web technology is changing faster than ever, and people who don’t understand these changes are going to have a hard time staying on top of things.
In the early days of the Web, we talked about Web pages, as if the Internet were a set of ordinary documents connected by links. This was true (and still is largely), but I don’t think that’s the best way to think of the Web any more. Today’s Web is not about documents, but about applications. Users and developers expect their pages to do things, not just be glorified documents.
This topic describes two critical and inter-related technologies: JavaScript and AJAX. JavaScript has been a part of the Web since the relatively early days. It is a simple but powerful programming language that was designed from the beginning to work within the context of a Web document. While JavaScript has been with us for a long time, it has recently seen a resurgence of interest in the form of AJAX. This new technology promises a lot of cool things, but it’s still rooted in the heritage of JavaScript and HTML.
The great thing about JavaScript and AJAX is the amount of power they give you. If you already know HTML or XHTML, you know how to create Web documents, but those documents are relatively lifeless and static.
JavaScript is a real programming language, and it allows you to add real programming capabilities to your pages. If you’ve never programmed before, this is a great place to start. JavaScript is a pleasant and relatively easy language for beginners. It uses the familiar Web page as a user interface, which makes it an easy way to develop forms and user interfaces. If you’re already a programmer, you’ll find that your previous knowledge extends easily to JavaScript, and you’ll be fluent in this skill in no time.
AJAX extends the capabilities of JavaScript in new ways that are still being explored. In one sense, the AJAX libraries assist in creating great user experiences with new interface elements like menus and sliders. In another sense, AJAX allows some very important features like the ability to perform client-side includes (a very handy tool for making your pages more efficient) and direct control of server-side scripts.
If you read this entire topic, you’ll be able to do amazing things with your Web pages. You’ll be able to get input from users, test the validity of user input, animate your pages, and interact with Web servers.

How This Topic Is Organized

I organized this topic by renting time on a supercomputer and applying a multilinear Bayesian artificial intelligence algorithm. No, I didn’t. I don’t even know what that means. I really just sketched it out during a meeting when I was supposed to be paying attention. In any case, the topic is organized into a number of sections that describe various aspects of Web development with JavaScript and AJAX.
Like the other topics in the For topic series, you can use this reference in many ways, depending on what you already know and what you want to learn. Each chapter of this topic describes a particular facet of JavaScript or AJAX programming. You can read the chapters in any order you wish, especially if you already have some knowledge and you’re looking for a particular skill. However, the chapters do build in complexity from beginning to end, so if you find you don’t understand something in a later chapter, you might want to review some earlier chapters. (I’ll point out exactly where you can find things you might need as we go.) If you’re just starting out, it’s probably easiest to go from beginning to end, but the main thing is to dig in and have some fun.

Part I: Programming with JavaScript

If you’ve never written a computer program before, consider this your boot camp. (But it’s kind of a fun boot camp, with a little more silliness than most — and no pushups in the rain.) Begin by building your toolkit of powerful but free tools and applications. Here you learn what programming is all about — with JavaScript as the language of choice. You’ll be introduced to new friends like variables, conditions, loops, arrays, and objects.

Part II: Using JavaScript to Enhance Your Pages

The main reason people use JavaScript is to trick out Web pages. In this section you learn how to write programs that talk to the Web page they live in. Your programs will be able to read user input, validate that input, and dance around on the screen. It’s pretty fun.

Part III: Moving Up to AJAX

If you’ve been hanging around with Web geeks, you’ve probably heard of AJAX. It’s kind of a big deal, and it has the potential to change the way Web development works. Learn what this thing is really about. Create some AJAX requests by hand, and then use the incredible jQuery library to do more powerful programming. Learn how jQuery introduces new ways to think about programming, and how to use the jQuery User Interface extension to build snappy user experiences. You’ll also learn how to work with various kinds of data, from PHP programs to XML and JSON. Yummy.

Part IV: The Part of Tens

No  topic would be complete without a Part of Tens. I’m really excited about these chapters. In one, you explore ten of my favorite jQuery plugins. These amazing tools make it easy to add amazing features to your sites. You’ll see plugins for automatically sorting tables, translating text into foreign languages, building graphs, showing image galleries, playing mp3 files, and much more. Another chapter points you toward some amazing resources on the Web to learn even more.

It’s Even on the Internet!

This topic has a couple of companion Web sites that are critical to understanding the topic. Web programming is about making Web pages do things, and you just won’t be able to see all of that in a topic. As you’re going through this topic, I strongly advise you to visit . A running version of every program in the topic is available on both of these sites. You’ll also be able to view the source code of each program in its natural habitat — running on the Web.
The  site is also a great place to start when you’re collecting your tools and libraries. Every tool or library that I describe in this topic is linked from the Web page, so you’ll definitely want to check it out. I also have a forum where I’m happy to answer your questions and share projects with you. I’m looking forward to seeing you there.

Next post:

Previous post: