php - images from ajax call onclick function
231
I use ajax to call a script that loads a gallery of images.
<?php
$dirname = $_GET["dirname"];
$images = scandir($dirname);
$ignore = Array(".", "..");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo "<img onclick='clicked()' src=$dirname/$curimg>\n";
};
}
?>
and the function "clicked()" is in the head of the page that runs the ajax call. For some reason, I can't get the "onclick" to call the "clicked()" function in the head of the main page. How do I fix this?
Answer
Solution:
Turns out I had an extraneous semicolon in the function on the main page.