0

I would like to redirect to another page using jQuery code. This is my event declaration:

<script>
    $(function () {
        var menu = $("#menu").kendoMenu({
            dataSource: [
                { text: "EMSS", cssClass: "emss" }
            ]
        }).css({ width: "100%" }).data("kendoMenu");

        //event declaration
        $("li.emss").click(redirectToPage);
    });

    function redirectToPage(url) {
        window.location.ref = url;
    }
</script>
<div id="menu" style="margin-right:0px;"></div>

How do I pass the page I would like to redirect to to the function? Or how can I do this in any other way?

Btw, I'm trying to redirect to an MVC page.

2
  • 1
    You have a typo: window.location.ref should be window.location.href Commented Oct 24, 2014 at 6:12
  • Thank you, @Thijs. Not really the solution to my problem, but it was something that was wrong. I've fixed it and, along with another answer, it works. Commented Oct 28, 2014 at 1:38

1 Answer 1

3

Just pass the argument to the function in the click handler

$("li.emss").click(function(){
  redirectToPage('my url');
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.