dk4210 Posted March 9, 2012 Share Posted March 9, 2012 Hello Guys, I have a page with thumb nails and a large image that changes when clicking on thumbnail. I need to display dynamic title for the image. It wont display because the page is not reloading.. How do you pass the name so it will show up without reloading? Here is the JS for switching dynamically loading the large image <script language="javascript"> $(document).ready(function() { $('.thumbnail').live("click", function() { $('#mainImage').hide(); $('#atitle').hide(); $('#imageWrap').css('background-image', "url('/images/ajax-loader.gif')"); var i = $('<img />').attr('src',this.href).load(function() { $('#mainImage').attr('src', i.attr('src')); $('#imageWrap').css('background-image', 'none'); $('#mainImage').fadeIn(); $('#atitle').fadeIn(); }); return false; }); }); </script> Here is the link for the thumb // Thumbnail Display echo '<a href="artists/'.$artist.'/'.$imgname.'.jpg" class="thumbnail"><img src="artists/'.$artist.'/previews/'.$imgname.'.jpg" border="0" /></a>'; [/code] Link to the large image // Large image display echo '<img src="artists/'.$artist.'/'.$first_image.'.jpg" alt="Main Image" id="mainImage"/>'; Here is the php echo for the title <? echo str_replace('"', '`', $iname); ?> I need to some how pass a php var from the thumb link to the js and have it display dynamically (Without Reloading) Hope I explained this correctly.. Please advise.. Thanks, Dan Quote Link to comment https://forums.phpfreaks.com/topic/258581-passing-a-php-var-to-javascript/ Share on other sites More sharing options...
dk4210 Posted March 9, 2012 Author Share Posted March 9, 2012 no one? Quote Link to comment https://forums.phpfreaks.com/topic/258581-passing-a-php-var-to-javascript/#findComment-1325545 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.