0

Does anyone has example, How to redirect to a new page in Jquery with MVC?

thank you

4 Answers 4

3

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>
Sign up to request clarification or add additional context in comments.

Comments

2

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';

Comments

2

to new page, do this:

window.location = 'welcome.php';

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.