Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am working in ASP.Net MVC. I am calling an Action Method from Javascript to redirect to another page. Following is my code.

$.ajax({
                type: "POST",
                datatype: "JSON",
                url: "@Url.Action("UserExists","Default")",
                data: {Email:$("#Email").val(),Password:$("#Password").val()},
                success: function (data)
                {
                    if (data == "yes") {
                        window.location="Home/Index" + $("#Email").val();// I wnat to send $("#Email).val() to Index method in Home controller.


                    }
                    else {
                        alert("Wrong");
                    }

                }
            });

Request and response is fine i.e. ajax calls. But not redirecting to other page, i.e. Home/Index/MyParameter . Please help me how to fix this problem.

share|improve this question
    
try "/Home/Index" + $("#Email").val(); –  chamara Jun 10 '13 at 2:23

1 Answer 1

Try this (i have put in an extra '/' after Index:

window.location="Home/Index/" + $("#Email").val();

Or this (where email is the name of your action parameter in Index):

window.location="Home/Index?email=" + $("#Email").val();
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.