I have written a website (in A.php) with a few tabs, each of which, when clicked on, retrieves multiple pictures data from another php file (= B.php) using jQuery's ajax and displays them. Those pictures are objects of a class (declared in C.php) and each picture has unique name, date when it was taken, and place where it was taken. They are all written in PHP and stored in php variables. Initially, when the data are asynchronously retrieved and the pictures are displayed, they only show the pictures and the name of them, but not the date and place. I want to make each picture show, using modal, the date and place only when they are clicked on.
I got the modal part working, but it is currently blank as I am not sure how to approach this problem and show the date and place for each photo.
Below is part of A.php where modal is, in which I want to show date and place of each photo:
<div class="modal">
<!-- Close modal process here (omitted)-->
<div class="date-and-place">
<?php
/*I am not sure what to write in here*/
?>
</div>
</div>
Below is B.php:
/*This is the data displayed on the screen after the tab is clicked on,
using ajax call from A.php
This will only show the pictures and the name*/
<?php
require_once("C.php");
?>
<div class="pictureData">
<!--loop through an array containing all picture objects-->
<?php foreach($pictures as $picture): ?>
<img class="picture"><?php echo $picture->getPicture() ?>
<h3 class="pictureName"><?php echo $picture->getName() ?></h3>
<?php endforeach ?>
</div>
And finally C.php:
/*This file only has class and object definitions*/
<?php
class Pics{
private $name;
private $imgURL;
private $date;
private $place;
}
/*There is constructor here, and each object is given name,
imgURL, date and place when created(omitted)*/
/*and there is getter functions for each as well (omitted)*/
/*Store each object data in an array*/
$pictures = array($object1, $object2, ....);
?>
How could you possibly show the specific photo's date and place information (only show the date and place of the picture clicked on)? Any help would be greatly appreciated and thanks in advance!