php - images from ajax call onclick function


I use ajax to call a script that loads a gallery of images.

$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?




Turns out I had an extraneous semicolon in the function on the main page.

People are also looking for solutions to the problem: php - SQL syntax error


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.