I am trying to use a Jquery script called 'fancybox'
I need it so the title will be a link to a selected page, the link needs to include the user and the image name. I can these by PHP $_GET & a Javascript function.
The problem is including them both together as one string if you like. Instead of executing the javascript to return the image name, instead it just displays the code itself.
My question is how do I execute the javascript to include in the link whilst using the PHP still? (it worked before I included the PHP part)
This is what I got so far:
jQuery(document).ready(function(){
var imagename = function( item ) {
return item.href.replace('/images/<?php echo $_GET['user']; ?>/', '');
}
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
margin : 20,
padding : 10,
openEffect : 'none',
closeEffect : 'none',
nextEffect : 'none',
prevEffect : 'none',
margin : [20, 60, 20, 60], // Increase left/right margin
showCloseButton : true,
showNavArrows : true,
title : '<a href="delete.php?boat=<?php echo $_GET['user'].'&image='; ?>'+imagename+'">Delete this image?</a>'
});
})
This is the link it produces:
http://xxx.xxx.xxx.xxx/delete.php?boat=BoatCV20&image=function%20(%20item%20)%20{%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20item.href.replace('/images/username1/',%20'');%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20}
Thanks.