I'm trying to build a href on the fly to pass it into fancybox iframe and pass the link into a php file
<script type="text/javascript">
jQuery(document).ready(function($){
$('a').each(function(){
var Href = 'GetImg.php?img=' + $(this).attr("href");
alert ("Href");
$(".Images").click(function() {
$.fancybox.open({
href : Href,
type : 'iframe',
padding : 5
});
});
};
}) ; // ready
</script>
Href is being set ie alert ("Href") and passed into the php file but isn't opening in the iframe. if i hard code
href : 'GetImg.php?img=/images/myImg.jpg' it works
my link is
<a class="Images" href="/images/myImg.jpg" title="A witty Title">Send to PHP</a>
FYI This is the GetImg.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>Holly Gibbons</title>
<script type="text/javascript" src="fancyBox-2.0.6/lib/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/ddpowerzoomer.js"></script>
<script type="text/javascript">
jQuery(function($){
$('#image3').addpowerzoom({
defaultpower: 2,
powerrange: [2,5],
largeimage: null,
magnifiersize: [100,100] //<--no comma following last option!
});
});
</script>
</head>
<body>
<?php
$my_img = $_GET['img'];
?>
<p> <img id="image3" src = <?php echo $my_img ?> /></p>
</body>
</html>
$('a > img')
? Theimg
tag doesn't seems to be there(within thea
tag). – code-jaffalert ("Href");
is just prints the stringHref
. – code-jaff