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.
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 ...