View Full Version : passing var to hidden div with href

06-07-2010, 08:17 PM
Hi all. A bit of a complicated one to explain (but is hopefully easy to solve :/)

I am designing a members website - call it a facebook clone, but it has different goals.

I have two main visible divs - one with the users photo, the other with a searched members photo from a db.

Clicking on a member will bring up profile information that is retrieved from the db.

As a seperate script, using href="seemember.php?id=1234" with a $_get already works.

The problem - Instead of using a different php page, I have a hidden div being called using colorbox/ (http://colorpowered.com/colorbox/).

The line calling currently looks like this:

<a class="profilecb" href="#"> <img src="<?php echo $dprofilepicture ?>" ></a>
This currently works great for displaying one profile, but ideally it need to be

<a class="profilecb" href="#?id=1234"> <img src="<?php echo $dprofilepicture ?>" ></a>
similar, in fact, to facebook.

However - I cannot get this var to the hidden div. (the div would then retrieve the relevant members db info and then display it)

I have tried every way I can think of to do this, even trying to use "include" within the div to see if I could uses an outside php script instead - all to no avail.

I believe the issue is with colorbox as the class is not CSS but JS. The line being
$(".profilecb").colorbox({width:"50%", height:"90%", inline:true, href:"#profile_cbox"});

Hopefully this makes sense, have been battling this for two days and my brain has fried...lol.

Any ideas on how to do this?

06-07-2010, 09:53 PM
Sounds like you're looking for AJAX functionality. You should be able to Google up thousands of tutorials quite easily. If you're using a javascript framework, check out their wrappers. If not, look at Jquery.