jQuery POST重定向

I have written a program in ASP.NET MVC and i have an issue with my AJAX function.

If my function return success i want to redirect to another page , in POST Method. I cant use window.location so i have to make a form which will execute a post method.

Here is my code :

<body>
<div class="login">
    <div class="login-screen">
        <div class="app-title">
            <h1>bla bla bla</h1>
        </div>

        <div class="login-form">
            <div class="control-group">
                <input type="text" class="login-field" value="" placeholder="bla bla bla" id="login-name">
                <label class="login-field-icon fui-user" for="login-name"></label>
            </div>
            <div class="control-group">
                <input type="password" class="login-field" value="" placeholder="bla bla bla" id="login-pass">
                <label class="login-field-icon fui-lock" for="login-pass"></label>
            </div>

           <input type="button" class="btn btn-primary" id="button" value="bla bla bla"/>
        </div>
    </div>
    <div id="failedLogin">
    </div>

</div>
</body>

<script src="~/Scripts/Login.js"></script>

Here is m js code

$("#button").click(function () {
    $.ajax({
        url: "home/signIn",
        data: { userName: $("#login-name").val(), Password: $("#login-pass").val() },
        success: function (result) {
            if (result == "success") {

                var redirect = function (url, method) {
                    $('<form>', {
                        method: method,
                        action: url
                    }).submit();
                };

                redirect('/Account/Menu?Name=' + $("#login-name").val(), 'post');
            }
            else {
                var content = $("#failedLogin");
                var label = "<label class=\"result\">bla bla bla </label>";
                content.html(label);
            }
        }
    })

my c# code :

public string  signIn(string userName , string Password)
{
    var db = new OsemEntities();

    var name= from u in db.*********
                where u.UserName == userName & u.UserPassword == Password
                select u.UserName;

    if (name.Count() == 1)
        return "success";
    else
        return "fail";


}

My post redirect doesnt work , i will glad to get some help.

Thanks!

  var redirect = function (url, method) {
                    $('<form>', {
                        type: method,
                        action: url
                    }).submit();
                };

Try This. method is depreciated. Use type instead

You need not return back to the Ajax function , you can handle this from your controller side .

  if (name.Count() == 1)
            return RedirectToAction("HomeView");
//In your HomeView you can have your first page
        else
            return View();