11.07.2015 Views

AJAX and PHP

AJAX and PHP

AJAX and PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>AJAX</strong> <strong>and</strong> the Future of Web ApplicationsFigure 1.7 shows the actions that happen when running this application:Figure 1.7: The Diagram Explaining the Inner Works of Your Quickstart ApplicationSteps 1 through 5 are a typical HTTP request. After making the request, the user needs to waituntil the page gets loaded. With typical (non-<strong>AJAX</strong>) web applications, such a page reload happensevery time the client needs to get new data from the server.Steps 5 through 9 demonstrate an <strong>AJAX</strong>-type call—more specifically, a sequence of asynchronousHTTP requests. The server is accessed in the background using the XMLHttpRequest object.During this period the user can continue to use the page normally, as if it was a normal desktopapplication. No page refresh or reload is experienced in order to retrieve data from the server <strong>and</strong>update the web page with that data.Now it's about time to implement this code on your machine. Before moving on, ensure you'veprepared your working environment as shown in Appendix A, where you're guided through how toinstall <strong>and</strong> set up <strong>PHP</strong> <strong>and</strong> Apache, <strong>and</strong> set up the database used for the examples in this book.(You won't need a database for this quickstart example.)20

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!