lundi 6 juillet 2020

It is necessary in php code where there is a js code to output, for example, through an alert variable

It is necessary in pva code where there is a js code to output, for example, through an alert variable. Does not work. Please help, tell me how to do it. And if anyone can how to use this as a yurl to the picture

function setLocation($url_image){
   $locationName = R::load('locationsdb', $url_image);
    echo '<script type="text/javascript">',
        'alert("'<?php echo $locationName; ?>'");',
        'var img = "<?php echo $locationName ?>";',
        'document.getElementById("image_location").src = img;',
        '</script>';
    
}



Aucun commentaire:

Enregistrer un commentaire