The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

emdeboas (7) [Avatar] Offline
This is a really nice comparison between the various ways you can use Ajax to communicate between client and server!

There is a small bug in the final listing for images_datacentric.js (listing 3.4)
At the top this line should be added:
var data={};
Otherwise you will pull your hair out why it does not work.

Again, I would like to complain about the crude PHP code shown in images.php. A shorter, and clearer piece of code would be:

<?php <br /> header("Content-type: text/xml; charset=utf-8"smilie;
require ('');
echo "<gallery path="$path" pre="$img_pre_path">";
echo "<folders>
foreach ($subdirs as $i => $value) {
echo "<folder>$value</folder>
echo "</folders>
echo "<images>
foreach ($imgs as $i => $value) {
echo "<image>$value</image>
echo "</images>
echo '</gallery>';

In a real production environment you would of course use one of the nice XML handling functions of PHP, but I agree that this is outside the scope of this chapter, although worth mentioning.