la seconda opzione è utilizzare una struttura di dati fissa come JSON per inviare dati al client in un formato comprensibile, per poi aggiornare solo quelli:

codice:
<ul id = "Thumbs">[*]
      [img]image.thumb.php?id=1[/img]
   [*]
      [img]image.thumb.php?id=2[/img]
   [*]
      [img]image.thumb.php?id=3[/img]
   [/list]
<div id = "ImageData">
<img id = "ImageBig" src = "" align = "left" />
<h3>Titolo</h3>
<p id = "Title">
</p>
<h3>Autore</h3>
<p id = "Author">
</p>
....

<form action = "image.update.php" method = "post" id = "UpdateForm">
   <input type = "hidden" name = "id" value = "" id = "ImageId" />
   ...
   
</form> 
</div>
Mentre il file image.data.php
Codice PHP:
<?php

<?php
   $id 
intval($_GET['id']);
   if(
$id == 0) exit(0);
   
$db = new PDO("mysql:dbname=ImageDB;host=localhost""user""password");
   
$query "SELECT * FROM Images WHERE id = $id";
   
$st $db->query($query);
   echo 
json_encode($st->fetch(PDO::FETCH_ASSOC));
?>
Il client otterrà come risposta una stringa:

codice:
{
   "id" : 1,
   "title" : "Test Image 1",
   "author" : "Pincopallino"
}
ed usando l'eval su di esso:

codice:
var obj = eval(response);
Potrà accedere ai dati come:

codice:
obj.id //ottiene 1
obj.title //ottiene "Test Image 1" etc, etc
Così può fare:

codice:
document.getElementById("ImageBig").src = obj.src;
document.getElementById("Title").src = obj.title;
document.getElementById("Author").src = obj.author;
e sostituirà direttamente i dati nell'HTML.