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 8629073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:42:40+00:00 2026-06-12T08:42:40+00:00

I was reading Rick Strahls http://www.west-wind.com/weblog/posts/2012/May/08/Passing-multiple-POST-parameters-to-Web-API-Controller-Methods I would like to be able to use

  • 0

I was reading Rick Strahls

http://www.west-wind.com/weblog/posts/2012/May/08/Passing-multiple-POST-parameters-to-Web-API-Controller-Methods

I would like to be able to use JObject in to the the action.
I wrote a controller like this

public class AlbumsController : Controller
{
    [System.Web.Http.HttpPost]
    public string PostAlbum(JObject jsonData)
    {
        return "success";
    } 
}

the front end looks like this

when the ajax gets called I get an error

       $("#a").click(function () { 
            var album = {
                AlbumName: "PowerAge",
                Entered: "1/1/1977"
            }
            $.ajax(
            {
                url: "Albums/PostAlbum",
                type: "POST",
                contentType: "application/json",
                data: JSON.stringify({ Album: album }),
                success: function (result) {
                    alert(result.Result);
                }
            });
        });

POST http://localhost:50066/Albums/PostAlbum 500 (Internal Server Error) jquery-1.7.1.js:8102
send jquery-1.7.1.js:8102
jQuery.extend.ajax jquery-1.7.1.js:7580
(anonymous function) albums:74
jQuery.event.dispatch jquery-1.7.1.js:3256
elemData.handle.eventHandle

  • 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-12T08:42:42+00:00Added an answer on June 12, 2026 at 8:42 am

    Your controller should derive from ApiController, not from Controller:

    public class AlbumsController : ApiController
    

    Also if you are using the default route setup:

    config.Routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "api/{controller}/{id}",
        defaults: new { id = RouteParameter.Optional }
    );
    

    I would recommend you to use RESTful action names:

    public class AlbumsController : ApiController
    {
        [HttpPost]
        public string Post(JObject jsonData)
        {
            return "success";
        } 
    }
    

    and then:

    $('#a').click(function () { 
        var album = {
            AlbumName: "PowerAge",
            Entered: "1/1/1977"
        }
        $.ajax({
            url: 'api/albums',
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify({ Album: album }),
                success: function (result) {
                    alert(result);
                }
            });
        });
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading the article on http://www.jamesward.com/2011/08/23/war-less-java-web-apps on how to embed an app server with your
Reading this list of Chrome match patterns: http://code.google.com/chrome/extensions/match_patterns.html How do I specify a match
Reading manual about Sling http://sling.apache.org/site/46-line-blog.html added folder blog and blog.html to destination: \launchpad\content\src\main\resources\content\ but
Reading code from other posts, I'm seeing something like this. struct Foo { Foo()
Reading the Redis documentation on Virtual Memory at: http://redis.io/topics/virtual-memory With regards to vm-max-threads they
reading this https://developers.google.com/in-app-payments/docs/tutorial Quoted from the above page: Because you sign the JWT using
I just got done reading Rick Anderson's article on Securing your ASP.NET MVC application
Reading the documentation at http://jersey.java.net/nonav/documentation/latest/client-api.html#d4e704 makes me think that ClientFilter s are processed in
Reading my own Feed in Facebook-API https://graph.facebook.com/me/feed with a valid Access-Token gives me the
Reading this post has left me wondering; are nightly builds ever better for a

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.