I have written jQuery code, in files Main.html and ajax.php. The ajax.php file returns the link of images to Main.html.
Now in Main.html, I have Image1, Image2, Image3, etc.
My Main.html file:
<html> ... # ajax.php Call ... # Return fields from Ajax.php </html>
My ajax.php file
echo '<a href='src1'><img src='src_path1' id='fid1' alt='Name1' /></a>Click To View image1\n'; echo '<a href='src2'><img src='src_path2' id='fid2' alt='Name2' /></a>Click To View image2\n'; // etc.
So, after executing ajax.php, I get the image locations in Main.html.
Now, when I click the Image1 link from Main.html, that corresponding image should display in the same window.
So I thought about whether again to use jQuery to view an image on the same page. How can I achieve this?
File
ajax.phpoutput must return the below HTML:And jQuery code: