I'm using the following code to display a result passed on by a click tracker in the URL of the webpage. The following goes before the "/head" tag:
<script>
function getURLParameter(name) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] === name){return pair[1];}
}
return "";
}
</script>
The following is in the "body" tag to display the result:
<script>document.write(getURLParameter('name'))</script>
However, the problem is that if the result is two words, the display looks like "Word20%Word"
Can someone help with this please?
Thanks in advance.