0

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.

1
  • try "/Home/Index" + $("#Email").val(); Commented Jun 10, 2013 at 2:23

2 Answers 2

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

Comments

0
window.location.href = "/GridOrderSummary/GridRowSummary?ticketId=" + 
ticketId;


 //Controller code
 public class GridOrderSummaryController : Controller
 {

    // GET: GridOrderSummary
    public ActionResult GridRowSummary(string ticketId)
    {
       // your code
        return View();
    }
}

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.