我试图将列表或字符串数组发送到控制器。我无法获得控制器中的值。 [英] I am trying to send the list or array of string to the controller. I am not able to get the value in the controller.
本文介绍了我试图将列表或字符串数组发送到控制器。我无法获得控制器中的值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将字符串列表或数组发送到控制器。我无法获得控制器的价值。
我尝试过的事情:
I am trying to send the list or array of string to the controller. I am not able to get the value in the controller.
What I have tried:
var selectedRowChartID = [];
$('.selectedrow').each(function () {
selectedRowChartID.push($(this).find('td.hiddenField-chartID input[type=hidden]').val());
});
$.ajax({
type: 'post',
url: '@Url.Action("SaveAuditTrail","DMS")',
async: false,
cache: false,
data: { "chartIDList": selectedRowChartID },
success: function (data) { },
error: function () { alert(selectedRowChartID); }
});
});
推荐答案
('。selectedrow')。each(function(){
selectedRowChartID。 push(
('.selectedrow').each(function () { selectedRowChartID.push(
(this).find('td.hiddenField-chartID input [type = hidden]')。val());
});
(this).find('td.hiddenField-chartID input[type=hidden]').val()); });
.ajax({
type:'post',
url:'@ Url.Action(SaveAuditTrail,DMS)',
async:false ,
cache:false,
data:{chartIDList:selectedRowChartID},
success:function(data){},
error:function(){alert(selectedRowChartID) ;}
});
});
.ajax({ type: 'post', url: '@Url.Action("SaveAuditTrail","DMS")', async: false, cache: false, data: { "chartIDList": selectedRowChartID }, success: function (data) { }, error: function () { alert(selectedRowChartID); } }); });
这篇关于我试图将列表或字符串数组发送到控制器。我无法获得控制器中的值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文