The parameters dictionary contains a null entry for parameter 'appId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ContentResult CheckForInstaller(Int32)' in 'HLIT_TicketingMVC.Controllers.TicketController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
function SubmitAjax(url, message, successFunc, errorFunc) {
$.ajax({
type:'POST',
url:url,
data:message,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success:successFunc,
error:errorFunc
});
};
The data object is built as follows:
var message={"appId":application.val()};
I have also tried a jsonified string:
var message="{'appId':"+application.val()+"}";
and
var message="{'appId':'"+application.val()+"'}";
I validated that the message is coming through with a proper int value before it tries to post. The mouse over debugger most recently showed: {appId="6"}
The method signature on the controller is:
public ContentResult CheckForInstaller(int appId)
When I remove the parameter from the method signature, it does hit the breakpoint inside, so it's either the signature needing attributes of some kind, or the message isn't built properly I believe.