introduction

The Visual QuickProject Guide you hold in your hands offers a unique way to learn about new technologies. Instead of drowning you in theoretical possbilities and lengthy explanations, this Visual QuickProject Guide uses big illustrations coupled with clear, concise step-by-step instructions to show you how to complete a specific project in a matter of hours.

This particular book in the Visual QuickProject series teaches you how to “roll your own” Ajax-enabled application. The specific example will involve managing employees in a company, organized by departments into a type of address book. But the actual example is secondary to the technologies and ideas being taught. By the end of this book, you’ll have a nice, working example; tons of usable code; and an education in Ajax that you can apply to your own projects.

how Ajax works

Normally, when a client—the user and their Web browser—requests a Web page, the server handles the request, sending the data back to the client. The client loads the data, redrawing the browser with the requested page. For each request, this process is repeated.

Image

Ajax is one way to create Rich Internet Applications (RIAs): Web sites that behave more like desktop applications. With an Ajax-enabled application, after the initial loading of the page, subsequent requests can be handled behind the scenes. Then the Web browser can be updated without the user being aware of the server requests, the downloading of data, and so on. In short, Ajax provides a nicer experience for the end user.

Image

what you’ll learn

Ajax isn’t really a “thing” in its own right so much as the combination of many technologies. In this book, those are (X)HTML, CSS, JavaScript, XML, PHP, MySQL, and SQL. The heart of an Ajax application is JavaScript and, in particular, a little thing called an XMLHttpRequest object. The XMLHttpRequest object wraps up all the functionality required to circumvent the old-fashioned client-server process.

However, this book won’t teach you how to create just an Ajax-enabled application. You’ll see how to create a Web site that also works for those users who can’t take advantage of Ajax (because their browser doesn’t support JavaScript and XMLHttpRequest). Creating an Ajax-enabled application that will still function for non-Ajax-enabled browsers is a two-step process.

In one chapter, you’ll create a non-Ajax version of some feature. The non-Ajax version will work for any user and show you, the developer, what this part of the site should do.

Image

The second step is to add the Ajax layer on top of the non-Ajax version. The intent of the Ajax layer will be the same as the non-Ajax layer, but all the steps will take place in a more sophisticated way for the end user.

Image

how this book works

The title of each section explains what idea is covered on that page.

Code blocks show what should be put in the various HTML, CSS, JavaScript, and PHP files. Sometimes code will appear in boldface to indicate that it is being added to existing code.

Captions explain what you’re doing and why.

Numbered steps indicate the order in which some things must occur.

Screenshots show how the code looks or what it does upon execution.

An ellipsis (...) in a code block indicates that there is more code than is being shown. Normally the omitted code has been generated on the previous pages.

Important pieces of code, such as variables, functions, and commands, as well as concepts, are emphasized.

Image

The extra bits section at the end of each chapter contains tips and tricks that you might like to know. The heading for each group of tips matches the section title. The page number next to the heading makes it easy to find the section to which the tips belong.

Image

required tools

This book covers the basics of Ajax but not of Web development. The assumption is that you already have, and know how to use, certain tools and technologies.

Image

A text editor, integrated development environment (IDE), or What You See Is What You Get (WYSIWYG) editor is a must. This might be BBEdit on the Macintosh (my personal favorite text editor), Notepad on Windows, Eclipse (a popular, open source IDE), or Dreamweaver (a popular, commercial WYSIWYG app). It doesn’t matter what you use as long as it’s something in which you can create and edit plain-text files.

The second requirement is a Web browser, but if you have a computer, you have one of these. Because Ajax can have browser-specific issues, you’ll want to have many different browsers on many different operating systems, if at all possible. I tested the book’s examples using Internet Explorer and Firefox on Windows (XP) and using Safari, Firefox, and Opera on Mac OS X.

I highly recommend that you use Firefox for development and initial testing purposes, as it’s far less quirky than Internet Explorer and has many great debugging tools.

Image

The most advanced requirement is a PHP-enabled Web server. You’ll need to run PHP through Apache, Microsoft’s Internet Information Server, or some other Web server. This can be on your own computer or on a hosted server. If you don’t know what PHP is, you should probably check out one of my PHP books before cracking this one (see “the next step” for recommendations).

If you’re using a hosted server, you’ll need to have an FTP (File Transfer Protocol) application or similar option for uploading files to the server from your computer.

Finally, you’ll need MySQL or another database application. This should be on the same computer as PHP. If you don’t know what MySQL is, again see “the next step” to check out one of my MySQL books. If you want to use a different database application, you’ll need to change some of the PHP code, and possibly the SQL commands, accordingly.

companion web site

The companion Web site for this book can be found at www.DMCInsights.com/ajax/.

Image

Head to the downloads area to get all of the book’s code so you don’t have to type it yourself.

After reading the book, check out the extras section for more information, alternative versions of the examples, and more.

If you have questions or need any assistance, head to the forum.

the next step

The focus in this book is creating a very good and usable Ajax-enabled application. There are a lot of technologies involved, the most important of which is JavaScript.

Image

For more discussion of PHP, MySQL, SQL, and XML, see some of my other books. A basic introduction to PHP can be found in my PHP for the World Wide Web, 2nd Edition: Visual QuickStart Guide (ISBN 0-321-24565-2). I provide thorough coverage of SQL and MySQL in MySQL, Second Edition: Visual QuickStart Guide (ISBN 0-321-37573-4). All of this information, and much more, is put together in my PHP and MySQL for Dynamic Web Sites, Second Edition: Visual QuickPro Guide (ISBN 0-321-33657-7). And I discuss XML in one chapter of my PHP 5 Advanced: Visual QuickPro Guide (ISBN 0-321-37601-3).

For more information on (X)HTML and CSS, see Elizabeth Castro’s excellent HTML, XHTML, and CSS, Sixth Edition: Visual QuickStart Guide (ISBN 0-321-43084-0).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.134.29