I wonder if there is a way to pass a null value through ajax. For example in the code below, sometime the toMessageId is not used but the server side requires it. Is there a way to pass something like this "toMessageId: null"? I tried and that didn't work. The way I do it now is to pass "0" value instead but that is not right. If I don't pass anything, it pops error. Please let me know. Thanks
Code: Select all
$.ajax(
{
type: "POST",
async: false,
url: "/Status/AddNewMessage",
data: {
message: msg,
toMessageId: 0,
sendBy: 'sendername'
},
success: function(html) {
alert("good to go");
},
error: function(error) {
alert(error);
}
});
}