The tilde only works on the server side. One way I have do it is to make a global javascript variable in the page that gets set with the application root by the server... something like this:
RegisterStartupScript(string.Format("<script language=\"javascript\">var _strAppRoot=\"{0}\";</script>", ResolveUrl("~"));
That should put this on the page:
<script language="javascript">var _strAppRoot="/MyApplicationName";</script>
You can then use that global var anywhere in your script to resolve a page or resource path on the client.
-
Peter