我正在将一个数组从我的 jquery 传递到控制器。我在jquery中有以下功能
function UpdateWeeklySalesReport_Clicked(AccName,HighComm) {
alert("function called");
var isChecked = $('table#HighlightsArea input#SelectHighlights').is(':checked');
alert('' + isChecked);
var HighlightsArea = [];
var count = $('table#HighlightsArea input[type=checkbox]:checked').length;
alert(''+count);
if (isChecked)
{
for(i=0;i=count;i++)
{
var row = $(this).closest('tr');
var AccName=row.find('td:nth-child(2)').text();
var HighComm=row.find('td:nth-child(3)').text();
HighlightsArea[0][AccountName] ;AccName;
HighlightsArea[0][HighlightsComments] ;HighComm;
HighlightsArea.push({ AccountName: AccName, HighlightsComments: HighComm });
}
}
$('[name="SelectHighlights"]:checked').each(function() {
var row = $(this).closest('tr');
var item = {
AccountName: row.find('td:nth-child(2)').text(),
HighlightsComments: row.find('td:nth-child(3)').text()
};
HighlightsArea.push(item);
});
//HighlightsArea.push({ AccountName: AccName, HighlightsComments: HighComm });
GetPartialView(
GetRootPath() + "/WeeklySales/FianlDraft", //URL
JSON.stringify(HighlightsArea), //Data:
WeeklySalesSucceeded //Success
);
var from = $('#FromDate').text();
//alert('' + from);
var to = $('#ToDate').text();
//var row = $('#HighlightsArea tr').filter(':has(:checkbox:checked)').find('td').text();
//alert('row'+row);
$('#FinalFromDate').html(from);
$('#FianlToDate').html(to);
//$('#HighlightsArea').
$('#FianlDraftTabHeader').removeClass('HideThis');
$('#enclosure').tabs('select', 3);
}
在我的控制器中,我需要处理数组以将数组传递给 web 服务。