$ .post与对象参数

I am trying to do a post with a custom model:

public class CallbackPriorityItemModel
{
    public int userID { get; set; }
    public int order { get; set; }
    public string name { get; set; }
}

But I am unable to get this to work. I have to following code:

function updateUserCallbackList() {
    var cbList = [];
    $(".callbackListItem").each(function () {
        cbList.push({
            Name: this.id,
            Order: $('li').index(this.parentElement),
            UserId: _userID
        });
    });
    var args = {
        CbList: cbList,
        UserID: _userID
    };
    $.post(SiteUtil.urlContent('/api/AccountApi/UpdateCallbackPriorityList?' +   $.param(args)));
}

Which calls this method:

[HttpPost]
public void UpdateCallbackPriorityList(CallbackPriorityItemModel[] cbList, int userID)

I have confirmed that cbList is not null in the javascript, but it is always null when it hits UpdateCalbackPriorityList, though userID is not null. I have tried to use other methods:

var url = SiteUtil.urlContent('/api/AccountApi/UpdateCallbackPriorityList/');
 $.ajax({
     url: url,
     type: 'POST',
     data: JSON.stringify(args),
     dataType: 'json',
     contentType: 'application/json; charset=utf-8'
 });

but I get errors saying the browser could not find UpdateCallbackPriorityList. Suggestions?

;

Try something like:

$.ajax({
    url: SiteUtil.urlContent('/api/AccountApi/UpdateCallbackPriorityList'),
    type: 'POST',
    data: args,
    contentType: 'application/json; charset=utf-8'
});

Newer versions of jQuery automatically serialize objects passed into $.ajax data params.

Other than that, the capitalization in your JS variable names doesn't match C# - I'm not sure if ASP corrects for that accordingly, can't hurt to try to change JS to match C# and see if that helps.