I have a Perl script which prints out of html page. I want to use javascript to pop alert msg. The alert message is defined as string in the perl variable. I am trying to pass the perl variable value to javascript function as argument but it's not working. Please help.
$perl_variable = "Welcome"; # alert msg
print <<START
<HTML>
some html code....
<p>Click the button to wait 3 seconds, then alert "Hello".</p>
<button onclick="myFunction('$perl_variable')">Try it</button>
<script>
function myFunction(var message){
setTimeout(function(){alert(message)},3000);
}
</script>
</HTML>
START
perl_variableinstead ofpath_qa_image? Look in your browser's error console; there is likely an error caused by not quoting the variable.