Example of Passing Data to a PHP Script With AJAX

This page shows an example of passing data from one page to another using Ajax.

When you click on any of the links below, the following things happen in the code:

  1. The client makes a request to the server for a specific PHP script, and passes data to that script the same way forms pass data using the GET method
  2. The server responds, and sends some content back to the client
  3. The client then puts those contents into a particular section of the current page

Pass the data name="Amos" to the script process_data.php
Pass the data name="Jared" to the script process_data.php
Pass the data name="Diana" to the script process_data.php

This orange box is the div with id="response_container".
The data the server sends back to the client in response to the AJAX request will show up here