2011-05-20 92 views

回答

3

它的完成为达林说:它可以通过window.location.href属性将浏览器重定向到给定的URL来完成。请注意,您可能想要使用相对uri。最简单的方法是定义一个包含基本uri的变量(我在示例中使用Razor视图引擎)。

<script type="text/javascript"> 
    var baseUri = '@Url.Content("~/")'; 

    function redirect() { 
     window.location.href = basUri + 'new/url'; 
    } 
</script> 
2

你真的不需要jquery这个。

window.location.href = '/new/url'; 
2

到新的页面,这样做:

window.location = 'welcome.php'; 
0
window.location = '@Url.Action("action","Controller")';*It gets in the way*