Passing array of integers to webapi Method

前端 未结 3 989
攒了一身酷
攒了一身酷 2020-12-10 17:38

I am trying to pass an array of int but I can not get the value in the webapi method

var postData = { \"deletedIds\": deletedIds };

    $.ajax({
        typ         


        
3条回答
  •  温柔的废话
    2020-12-10 17:59

    I suspect that the stringify bit is messing up your object - have you tried assigning it to a variable to see if it's the expected formatting?

    You're stringifying the whole thing at the moment:

    { "deletedIds": deletedIds }

    while what you probably want to send as post body is this:

    { "deletedIds": JSON.stringify(deletedIds) }

提交回复
热议问题