get ~/mypage.aspx for use in dynamic javascript

N

nic

Hi,
I need to get the equivilent of Response.Redirect
(~/mypage.aspx) for a dynamic javascript function.
Essentially I am writing the javascript on the non-code
behind page and need to inject the "~" so I can have a
relative path to my page. So here is the javascript
function:

function showHelp(fieldID)
{
var ahref = "FieldHelp.aspx?FieldID=" + fieldID;
var win = window.open(ahref,"","height=200,width=400");
}

I need the ~/FieldHelp.aspx path but don't know how to get
it. I tried
var ahref = "<%= ~/FieldHelp.aspx%>?FieldID=" + fieldID;

but that doesn't work.

I think injecting serverside code in a dynamic javascript
funtion makes the function more readable than to build it
all server side and inject the whole stream.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,017
Latest member
GreenAcreCBDGummiesReview

Latest Threads

Top