0% found this document useful (0 votes)
4 views2 pages

Understanding AJAX: XML, PHP, and JSON

AJAX, or Asynchronous JavaScript and XML, is a web development technique that allows for data exchange with a server without reloading the entire page, enhancing user experience and reducing server load. It utilizes JavaScript, XMLHttpRequest or Fetch API, and data formats like XML or JSON for communication. The document also covers server-side setup with PHP and client-side implementation details for both XML and JSON responses.

Uploaded by

juug22btech51409
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Understanding AJAX: XML, PHP, and JSON

AJAX, or Asynchronous JavaScript and XML, is a web development technique that allows for data exchange with a server without reloading the entire page, enhancing user experience and reducing server load. It utilizes JavaScript, XMLHttpRequest or Fetch API, and data formats like XML or JSON for communication. The document also covers server-side setup with PHP and client-side implementation details for both XML and JSON responses.

Uploaded by

juug22btech51409
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE 5

AJAX: Introduction, AJAX with XML and PHP, AJAX Database.

Introduction
• AJAX stands for Asynchronous JavaScript and XML.
• It’s a technique used in web development to send and receive data from a server without
reloading the entire web page.
• Before AJAX, if you clicked a button or submitted a form, the whole page had to reload to get
new data.
• With AJAX, only the needed parts of the page update — making websites faster, smoother, and
more user-friendly.
• Bene ts:
Better user experience (no full page reloads).
Reduces server load.

• How does AJAX work?


You send a request to the server in the background using JavaScript.
The server processes it and sends back data (usually in XML or JSON format).
JavaScript then updates only the necessary part of the web page — without refreshing the whole
page.

• Technologies Involved
JavaScript: To create the AJAX request.
XMLHttpRequest or Fetch API: To talk to the server.
XML or JSON: To exchange data.

• Real-World Examples
When you scroll Instagram or YouTube — new posts/videos load automatically (that's AJAX!).
Search suggestions in Google while typing.
Submitting a form without leaving the page.

AJAX with XML and PHP - Server-Side Setup

PHP is used to create server-side scripts.


XML is used for data exchange (tags, attributes, elements).
PHP scripts receive AJAX requests, process them, and return XML responses.

AJAX with XML - Client-Side Implementation

Create an XMLHttpRequest object.


Open a connection (GET/POST) and send a request.
Check readyState and status to ensure the response is ready and successful.
Retrieve the server’s responseText.
Parse XML data from the response and dynamically update the DOM.

AJAX with JSON - Client-Side Adjustments

Receive JSON response.


Parse JSON using [Link]().
Access the parsed data easily (objects/arrays).
Compare parsing XML vs JSON and understand why JSON is better for most modern apps.
fi

You might also like