大家好,我在选择下拉列表时有一个多选 dropdwon 我正在调用 api 控制器,因为它是一个多选下拉列表我有一组要传递给 api 的 id ..我一直在尝试一种方法,但我遇到了一个异常
this is what i have been trying
function GetProducts(obj) {
var SelProdids = [];
var selIds = $(obj).val();
if (selIds.length > 0) {
for (var i = 0; i < selIds.length; i++) {
SelProdids.push(parseInt(selIds[i]));
}
}
var params = {};
params.CatIds = SelProdids;
$.getJSON('http://localhost:6098/api/Marketing/GetProducts', { CategoryIds:params}, function (key,Products) {
});
}
and my api method looks like this
Public Product GetAllProducts(long[] CategoryIds)
{
}
但我得到一个例外说
**Exception**
{"ExceptionType":"System.InvalidOperationException","Message":"No MediaTypeFormatter is available to read an object of type 'Int64[]' from content with media type ''undefined''."
谁能帮我解决这个问题...