XML AJAXLesson 26Free preview
AJAX PHP
This lesson is part of XML · All levels
Summary
PHP is often used as a server-side in AJAX applications because it is capable of reading databases, processing data, and then sending it as XML or JSON. Simply set the correct Content-Type header before output, and the query results can be sent directly to the client. The AJAX page then calls this PHP script through the URL.
Key points
- PHP sets up the data and sends it to the AJAX page
- Content-Type header must be set before output
- PHP reads the request parameters through $_GET and $_POST
- Extensions like SimpleXML help form XML
- The output of PHP can be JSON with json_encode
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.