27.10.2015 Views

AJAX and PHP

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>AJAX</strong> RSS Reader<br />

4. The application will look like Figure 9.2:<br />

Figure 9.2: Our <strong>AJAX</strong>-enabled RSS Reader Start Page<br />

Feeds are loaded dynamically <strong>and</strong> are displayed as links in the left column. Clicking on a feed will<br />

trigger an HTTP request <strong>and</strong> the server script will acquire the desired RSS feed.<br />

The server then formats the feed with XSL <strong>and</strong> returns an XML string. Results are then displayed<br />

in a human-readable form.<br />

Time for Action—Building the RSS Reader Application<br />

1. In your ajax folder, create a new folder named rss_reader.<br />

2. Let's start with the server. Create a new file named rss_reader.php, <strong>and</strong> add this<br />

code to it:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!