Loading HTML from a web server into a page
At the most basic level, AJAX allows us to update a single page element with new content from a web server. This recipe looks at how we can set up some data to be received from a web server with PHP and how we can then receive this data and apply it to our web page.
Getting ready
Ensure that you have a web server running and have access to its web root.
How to do it…
Perform the following steps to create the required PHP, MySQL, and HTML in order to understand how to use jQuery with AJAX:
- Before we can request for any data from the web server to be displayed within our web page, we need to be able to serve this data from a web server. Create a PHP file named
request-1.php
. Add the following PHP code and save ...
Get jQuery 2.0 Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.