I am trying to use darkbox and have ran into an error I do not understand. I am displaying a random image when the page loads or refreshes. That part works okay, different images occur. However the error console on Safari reports "Can't find variable:$, and nothing happens when I click the image. The line in question is in the script near the end, $(document).ready(function()
This is my code. I am not very good at javascript so I am not surprised if the answer is obvious to others. Sorry about the badly formatted code.
<?php
$imageList = array();
foreach(glob('randomimages/*.*') as $file) {
$imageList[] = $file;
}
$image = $imageList[array_rand($imageList)];
?>
<img src="<?php echo $image?>" id="darkboximg" data-darkbox="randomimages/<?php echo $image?>">
<div id="darkboximg" style="width:100%"></div>
<script>
$(document).ready(function(){
$("#darkboximg").load("$image");
});
</script>
</div>