Does anyone has example, How to 开发者_运维知识库redirect to a new page in Jquery with MVC?
thank you
It's done as Darin says. Note that you might want to use a relative uri. The easiest way is to define a variable that contains the base uri (I'm using Razor view engine in the example).
<script type="text/javascript">
var baseUri = '@Url.Content("~/")';
function redirect() {
window.location.href = basUri + 'new/url';
}
</script>
You don't really need jquery for this. It can be done using the window.location.href
property which will redirect the browser to the given url:
window.location.href = '/new/url';
to new page, do this:
window.location = 'welcome.php';
window.location = '@Url.Action("action","Controller")';*It gets in the way*
精彩评论