ciao! in base all'immagine cliccata mi carico delle altre immagini con ajax al click di queste immagini caricate dovrebbe fare un'altra istruzione ma non funziona più nemmeno un alert
come faccio ad associare un codice all'onclick di immagini caricate dopo nel documento??
grazie dell'aiuto
insomma ho al click in base all'immagine ho questo ajax:
codice:
switch(target) {
case "f305-0.png":
$.ajax({
url: 'page.php?cod=f305',
success: function(data) {
$('div.demo-container').html(data);
alert('Load was performed.');
}
});
la page ha questa funzione php:
Codice PHP:
function createGallery2( $fcode)
{
$pathToImages='img/filiformati/'.$fcode.'/';
$pathToThumbs='img/filithumbs/'.$fcode.'/';
$output .= "<table cellspacing=\"0\" cellpadding=\"2\" width=\"350\">";
$output .= "<tr>";
// open the directory
$dir = opendir( $pathToThumbs );
$counter = 0;
// loop through the directory
while (false !== ($fname = readdir($dir)))
{
// strip the . and .. entries out
if ($fname != '.' && $fname != '..')
{
$output .= "<td valign=\"middle\" align=\"center\"><a href=\"#\">";
$output .= "
<img src=\"{$pathToThumbs}{$fname}\" border=\"0\" class=\"miniatura2\" id=\"{$fname}\" /></p>";
// $output .="
".$fname." </p>";
$output .= "</a></td>";
$counter += 1;
if ( $counter % 3 == 0 ) { $output .= "</tr><tr>"; }
}
}
// close the directory
closedir( $dir );
$output .= "</tr>";
$output .= "</table>";
echo $output;
}
$cod=$_GET['cod'];
createGallery2($cod);
poi ho questo codice nella pagina dove carico le immagini ma non funziona:
codice:
$("img.miniatura2").click(function () {
alert("ok");
});