JonnySnip3r Posted August 22, 2010 Share Posted August 22, 2010 Hey guys i have been making a php gallery and i want to do the rest using jquery, when you click an album cover at the top of the page how can i have its contents loaded into a div below. Ok i loop through all the albums at the top of the page using php and they all display fine when you hover you see various information and when you upload an image its linked to what ever album you have chosen so if i choose say the first album it will be linked to all the images in that album (Sorry if im confusing you) SO anyways i have an id="" attached to each album, is there a way in jquery i can pass that id using $.ajax and return all the images in a div below? i have been looking high and low and cant find much on it. im fairly new to jquery but getting the hang of it i think. Hope someone can help point me in the right direction Quote Link to comment Share on other sites More sharing options...
sohaibshaheen Posted August 29, 2010 Share Posted August 29, 2010 sure there is: just attach onclick with the album e.g. <div id="11" class="album" onclick="load_images(this);"> whatever .... </div> function load_images(obj){ var id=$(obj).attr("id"); $.get("load_from_page.php", { id: id}, function(data){ $('#where_to_load').html(data); }); } } Hope this answers the question Quote Link to comment Share on other sites More sharing options...
sohaibshaheen Posted August 29, 2010 Share Posted August 29, 2010 Forgot to mention: You will receive $_GET['id']; on the loading php page Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.