In the below code I am passing an empty value for "FirstName". When the Ajax POST request is made on the controller side the "FirstName" parameter value is coming as Null but if I pass any value the value is binded to the parameter. Only for the empty values, the value is showing as null in asp.Net core project
Javascript:
var dataVal = {};
dataVal["FirstName"] = "";
$.ajax({
type: "POST",
"url":url,
data:dataVal,
dataType: "json",
async: false,
success: function (m) {
if(m){
alert(m);
}
},
error: function(err){
}
});
Controller:
public IActionResult Home(string FirstName){
}