开发者

Jquery Delay Redirect MVC ASP.Net

开发者 https://www.devze.com 2023-03-07 18:50 出处:网络
Does anyone has example, How to 开发者_运维知识库redirect to a new page in Jquery with MVC? thank youIt\'s done as Darin says. Note that you might want to use a relative uri. The easiest way is to de

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*
0

精彩评论

暂无评论...
验证码 换一张
取 消