2011-05-20 94 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*