We have an MVC3 application in IIS7: http://mydomain.com/myapplication/
What would be the relative URL in javascript for:
http://mydomain.com/myapplication/mycontroller/myaction
/mycontroller/myaction – goes to http://mydomain.com/mycontroller/myaction
../mycontroller/myaction – goes up one level (in this case also to http://mydomain.com/mycontroller/myaction)
mycontroller/myaction – goes to http://mydomain.com/myapplication/mycontroller/myaction when running as dev on localhost but on server goes to http://mydomain.com/mycontroller/myaction
./mycontroller/myaction – was what I figured would be right, but that didn’t work either!
If you are developing in ASP.NET MVC you can set root var on server side like this:
and use it in JS: