cmb Posted August 31, 2012 Share Posted August 31, 2012 So what i'm trying to do is a user selects a gallery, and then it shows up with out the page reloading. The number of pictures varies in each gallery. This is what i have attempted but instead of showing the images in the div nothing happens, but looking at the source code in the developer tools it is there. Ajax code: <script type="text/javascript"> function ajax(gal){ $.ajax({ cache: false, type: "GET", url: "ths.php", data: "gal=" + gal, success: function(p){ document.getElementById('thumbs').innerHTML = p; } }); } </script> php code: <?php include("database.php"); $gal = $_GET['gal']; $query = "SELECT * FROM ths_soccer WHERE Gallery_no = '$gal'"; $results = mysql_query($query); $row = mysql_fetch_assoc($results); $x = $row['no_Pics']; $gender = $row['Gender']; $day = $row['Date_Played']; $y = 1; echo "<ul class='thumbs noscript'>"; echo " <script type=\"text/javascript\" src=\"../../js/jquery.galleriffic.js\"></script>"; echo "<ul class='thumbs noscript'>"; if ($x == 0){ echo "<li> <a class='thumb' href='../../images/nopics.jpg' title=''><img src='../../images/nopicsthumb.jpg ' /></a></li>"; }else if ($x == 10000){ echo "<li> <a class='thumb' href='../../images/coming.jpg' title=''><img src='../../images/comingthumb.jpg ' /></a></li>"; }else{ while ($y <= $x){ echo "<li> <a class='thumb' href='../../images/Sections/ths/" . $gender . "/" . $day . "/" . $y . ".jpg' title=''><img src='../../images/Sections/ths/" . $gender . "/" . $day . "/thumbs/" . $y . ".jpg ' /></a><div class='caption'><div class='download'><a href='../../images/Sections/ths/" . $gender . "/" . $day . "/big/" . $y . ".jpg ' target='_blank' />Download</a></div></div></li>"; $y ++ ; } } echo "</ul>"; echo "</ul>"; ?> Link to comment https://forums.phpfreaks.com/topic/267836-ajax-photo-gallery/ Share on other sites More sharing options...
jazzman1 Posted September 2, 2012 Share Posted September 2, 2012 url: "ths.php" to url: "ths.php?" B/s you're using a GET method Link to comment https://forums.phpfreaks.com/topic/267836-ajax-photo-gallery/#findComment-1374655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.