嗨,我有以下代码
在 JQuery 中:
this.myFunction = function()
{
var dto =
{
id : getID()
};
//alert(getID();) to verify that my number is indeed non zero.
$.ajax({
type: "POST",
url: "Create",
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(dto),
dataType: "json",
success: function(result) {
alert("Data Returned: ");
}
});
}
在 C# 中
public void myCFunction(int i)
{
//do some stuff
}
当我在 Visual Studios 中运行调试器时,我注意到我的 C# 函数中的整数始终为零,尽管我传递的值不是零。