I have a piece of HTML which should look something like the following when rendered by the browser:
<b>This is a test</b><a href="foo.php?bar=yay">Test over!</a>
The problem I have is that foo.php
is defined in a javascript var in the document. For argument sake, the name of the var is myPath
. I'm trying to figure out how to get rid of the hard coded foo.php
from the HTML above and have it read it from myPath
instead.
I've tried different variations of escaping quotes and document.write()
but haven't had much luck.
Is there a way to do something similar to:
<a href=" + myPath + "?bar=yay">
and have it render foo.php
from myPath
?