There are 3 elements to this.
- An HTML form
- The AJAX connection which sends the form values and receives and parses response from the PHP script
- The PHP script which decides whether the values are good/bad or not and sends back an appropriate response (probably in XML format for easy parsing by the javascript function?)