O'Reilly logo

Learning JavaScript, 2nd Edition by Shelley Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Moving Outside the Page with Ajax

Ajax originally encompassed functionality that allowed in-page communication between the client page and the server. Its meaning has now grown to also include most dynamic web page effects, including those that used to be labeled Dynamic HTML (DHTML). More than any previous innovation, Ajax has led to a greater interest in JavaScript in general and dynamic JavaScript functionality in particular.

The Ajax examples in this chapter differ from examples in previous chapters in that Ajax requires a server component. Ruby is a popular choice of programming language for Ajax development, but any server-side language that can process the specialized Ajax requests will work. The examples in this chapter use PHP, primarily because out of all the languages it’s the most similar to JavaScript, and because it’s one of the most common server-side scripting languages in use.

Note

Technically, you don’t need to use a server-side language to support an Ajax application; you just need the response to be served from a server. So, you could instead use a library of static HTML or XML files on the server that are returned based on the Uniform Resource Identifier (URI) of the request. However, a server-side application processing a request and formulating a response is the common type of Ajax application, and the one I’ll be demonstrating in this chapter and the next.

How Ajax Works

Ajax is not as complicated as it may seem at first. A request needs to be sent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required