Jump to content

jQuery load page in div help


JonnySnip3r

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/211402-jquery-load-page-in-div-help/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.