Here is an excerpt from a book – Beginning Ajax with PHP: From Novice to Professional.
Throughout this chapter, I will run through some examples of how PHP and Ajax can be used together to design some basic tools that are quite new to Internet applications but have been accessible to desktop applications for ages. The ability to make a call to the server without a page refresh is one that is quite powerful, if harnessed correctly. With the help of the powerful PHP server-side language, you can create some handy little applica-tions that can be easily integrated into any web project.
Why PHP and Ajax?
PHP has been and will likely continue to be a very open form of technology. While code written in PHP is always hidden from the web user, there is a massive community of developers who prefer to share and share alike when it comes to their code. You need only scour the web to find an abundance of examples, ranging from the most basic to the most in-depth. When comparing PHP’s online community against a coding language such as ASP.NET, it is not difficult to see the differences.
Client-Driven Communication, Server-Side Processing
As I have explained in previous chapters, there are two sides to a web page’s proverbial coin. There is the client-side communication aspect—that is, the functionality happen-ing right then and there on the client’s browser; and the server-side processing—the more intricate levels of scripting, which include database interaction, complex formulas, conditional statements, and much, much more.
In order to get geared up for some of the more intricate and involved examples, I will begin by showing some basic examples of common web mini-applications that work well with the Ajax ideology. These are examples you are likely to see already in place in a variety of web applications, and they are a very good basis for showing what can be accomplished using the Ajax functionality.
Beyond the fact that these applications have become exceedingly popular, this chap-ter will attempt to guide you as to what makes these pieces of functionality so well-suited to the Ajax concept. Not every application of Ajax is necessarily a good idea, so it is important to note why these examples work well with the Ajax concept, and how they make the user’s web-browsing experience better. What would the same application look like if the page had to refresh? Would the same functionality have even been possible without Ajax, and how much work does it save us (if any)?