Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9079901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:56:42+00:00 2026-06-16T19:56:42+00:00

Working on MVC 3 application with some CRUD operations with jQuery ajax. I post

  • 0

Working on MVC 3 application with some CRUD operations with jQuery ajax.

I post my user detail form to controller method to Save the information.
Once the information get saved, i am redirecting to Detail page by passing saved id and some tempdata information to show some message like ‘User saved successfull’

But it is not at going to Detail method in controller, after SaveUserDetail method.

Here is my controller code

    [HttpPost, Authorize]
    public ActionResult UserDetail(string Id)
    {
     User user = AdminService.SelectUserByUserName(Id);
     UserDetailViewModel viewModel = Mapper.Map<User, UserDetailViewModel>(user);
        if (TempData["SaveStatus"] != null && TempData["SaveStatus"] == "true")
        {
            viewModel.InSaveMode = true;
            viewModel.SaveStatus = true;
        }
        return View(viewModel);
    }

    [HttpPost, Authorize, ValidateAntiForgeryToken]
    public ActionResult SaveUserDetail(UserDetailViewModel viewModel)
    {
        User userToSave = new User();
        AdminService.UpdateUser(userToSave);
        TempData["SaveStatus"] = "true";
        return RedirectToAction("UserDetail", new { Id = viewModel.userId});
    }

My jQuery code

 $("#user-detail-form").submit(function (e) {
        if ($(this).valid()) {
            $.post('@Url.Action("SaveUserDetail")', 
                       $(this).serialize(), function (data) {
                $("#user-detail-box").html(data);
                $.validator.unobtrusive.parse($("#user-detail-box"));
            });
        }
        e.preventDefault();
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:56:43+00:00Added an answer on June 16, 2026 at 7:56 pm

    Get rid of the [HttpPost] attribute from your UserDetail method if you intend to redirect to it.

    If a controller action is decorated with the [HttpPost] attribute this means that this action is accessible only with the POST HTTP verb. But in your case you are redirecting to it (return RedirectToAction("UserDetail", new { Id = viewModel.userId});) and as you know a redirect in HTTP means 302 status code with a Location header followed by a GET request by the client to the target location.

    If you had used FireBug or a similar javascript debugging tool in your browser to analyze the AJAX request you would have immediately seen this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on my second CI application. I have created some simple CRUD
I'm working on a typical CRUD application in ASP.NET MVC where there will be
I'm working on an ASP.NET MVC 3 application and having some issues. I've got
I'm working on my first ASP.NET MVC 3 application with utilizes some JavaScript and
I am currently working on a ASP .Net MVC 3 application to do some
I'm working on an MVC 4 application. I've a controller where I make calls
I've been working on my first major ASP.NET MVC application (plus lots of jQuery)
I'm working on an ASP.NET MVC application, and am trying to write some unit
I'm working on an MVC application and i'm trying to implement some validation. I've
I am working on asp.net MVC application. I have a folder with some sub

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.