I am having some trouble creating a post using a customized model:
public class CallbackPriorityItemModel
{
public int userID { get; set; }
public int order { get; set; }
public string name { get; set; }
}
Unfortunately, I can't seem to make this work. Here is the code I have:
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)));
}
This code calls the following method:
[HttpPost]
public void UpdateCallbackPriorityList(CallbackPriorityItemModel[] cbList, int userID)
I have verified that cbList is not null in the javascript, but it always appears as null when it reaches UpdateCalbackPriorityList, even though userID is not null. I have also attempted using 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'
});
However, I receive errors stating that the browser could not locate UpdateCallbackPriorityList. Any suggestions?
;