如何使用JSON,jQuery向ASP.NET MVC Controller發(fā)布復(fù)雜對(duì)象數(shù)組?我當(dāng)前的代碼如下所示。如何將我的數(shù)組傳遞給控制器以及控制器操作必須接受哪種參數(shù)?function getplaceholders() {
var placeholders = $('.ui-sortable');
var result = new Array();
placeholders.each(function() {
var ph = $(this).attr('id');
var sections = $(this).find('.sort');
var section;
sections.each(function(i, item) {
var sid = $(item).attr('id');
result.push({ 'SectionId': sid, 'Placeholder': ph, 'Position': i });
});
});
alert(result.toString());
$.post(
'/portal/Designer.mvc/SaveOrUpdate',
result,
function(data) {
alert(data.Result);
}, "json");};我的控制器動(dòng)作方法看起來(lái)像public JsonResult SaveOrUpdate(IList<PageDesignWidget> widgets)
如何使用JSON,jQuery向ASP.NET MVC Controller發(fā)布復(fù)雜對(duì)象數(shù)組?
慕田峪9158850
2019-08-15 15:28:00