1. Here is an example of HTML code where I am calling the javascript function changeButton:
<a href="#" class="btn btn-primary btn-sm" onclick="changeButton( "{{ request.session.variable }}" );return false;">Button</a>
2. This is the JavaScript function being called:
function changeBookNowButton(variable) {
document.getElementById("bookButton").innerHTML=variable
}
3. The value of the argument 'request.session.variable' is: joe
I encountered an error: 1. SyntaxError: syntax error occurs if I pass the argument in double quotes "{{ request.session.variable }}" 2. Without quotes, {{ request.session.variable }} results in a ReferenceError: joe is not defined.