I have some javacsript code looking something like below. Notice how it makes a ajax call to "/ContollerName/ActionName" with some parameters. This works fine as long as the application is deployed on a site root in IIS. But if I deploy it on a virtual directory the path will point all the way back to the site root and it will fail.
$.get("/ControllerName/ActionName", { foo: _bar, foo2: $(titleRow).attr("id"),
Direction: direction
}, function(data, success) {
if (eval(data).Result == _successEnum) {
successfulCallback();
} else {
failCallback(errorMessage, eval(data).LogPath);
}
}, "json");
How can I make it so it can be deployed both on site root level and on a virtual directory.
Both the below should basically work. I use ASP.NET MVC.