我在将整数数组传递给MVC控制器时遇到了一些问题。通过AJAX将整数数组传递给MVC控制器
我抓住我的值如下:
$checkedItems = $(':checked');
我阿贾克斯后的格式如下:
$.ajax({
url: '/Items/MarkUnsuitable',
type: 'POST',
traditional: true,
data: { checkedRecords: $checkedItems, deletionReason: reason, deletionDescription: description },
error: function (xhr, ajaxOptions, thrownError) {
alert('An error occured when processing this request:\r\n\r\n' + thrownError);
},
我控制器接收这样的数据。唯一缺失的值是int []
public ActionResult MarkUnsuitable(int[] checkedRecords, int? deletionReason, string deletionDescription)
有人可以帮我解决这个问题吗?
尝试使用Firebug看到的数据被发送的内容。确保数据的格式可以映射到int []数组中。 –