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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.