I'm trying to create my own version of a carousel that changes the background image of a div when one div is clicked. Each one of those div's images will be defined through a PHP record that matches a variable. Below, you will find my idea. I was wondering how I would go about echoing a PHP record within the CSS changes. Thanks in advance!
I've tried defining a Javascript variable to output it, and it doesn't work. In addition to that, I've also tried just putting the PHP echo script in there.
function myImage1() {
$('#change').on('click', function() {
var image="<?php echo $record['img'] ?>";
document.write (message);
$('#background').css('background-image', 'url(document.write (message))');})}