asp.net mvc - Redirect to MVC action through jQuery without having to reference the folder it is in? -
i able redirect mvc action through jquery unless changed root. before localhost
, localhost/app
. before redirecting this:
window.location.href = '/mycontroller/myview/' + myparameter;
now, need change to:
window.location.href = 'app/mycontroller/myview/' + myparameter;
i don't want because later on might need move other folder. how redirect url without having reference folder in?
you can use @url.routeurl
make first bits, or command in @url
e.g @url.action
, can make url bit.
does help?
so
window.location.href = '@url.action("action","controller",new {id = null})/' + myparameter;
should trick.
Comments
Post a Comment