If you are looking for a simple script to navigate next / previous image without refreshing page, this example will do exactly that using jQuery Ajax and PHP.
Following SQL code creates a table named “pictures” with 3 columns (id, PictureTitle, PictureName) and inserts pictures data into the table.
A picture will be loaded primarily, and then user can navigate to next / previous images without refreshing the page. Below is the jQuery code that sends Ajax request to getpicture.php to fetch picures.
File gets image id from index.php, and gets image information from database, creates next/previous button returns image data back to index.php. Replace xxxxx with your MySQL username, password and database name.