I am a attempting to pass a URL inside a javascript onclick function but it returns missing ) error on console log, i experiment on it and found out that the URL contains special characters and sometimes spaces that escape the onclick event.
I am getting the url from a PHP script
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
and passing it on a onclick event
<a href="#" class="btn btn-primary" id="main" onclick="getContent(<?php echo $actual_link;?>);">Content 1</a>
My question is how to pass a url text inside a javascript function.