ajaxを使用してList to controllerメソッドを渡そうとしています。例私は以下のようにリスト内の2つのオブジェクトです。私は、コントローラ内の2つのオブジェクトを取得していますが、内部の性質はajax呼び出しを使用してコントローラ内のオブジェクトのリストを渡します。
var dataObject = { 'sections': sectionsOrder};
console.log(dataObject);
CustomAjaxRequest("Post", "@Url.Action("UpdateOrderHoldingsForSections", "Renewal")" ,
dataObject, "json", "UpdateSectionsViewWithLatestOrderHoldings",
null, true);
[HttpPost]
public ActionResult UpdateOrderHoldingsForSections(List<OrderHoldings> sections)
{
return null;
}
null
でも、私は何も作業はまだvar dataObject = { 'sections': json.stringify(sectionsOrder)};
を試しています。何が問題なの?コンソールで
値に
フルモデル(jsとC#)がなければ、何が起きているのかを伝えるのは非常に難しく、コードに追加するのは非常に難しいです。 – Gusman
あなたの 'CustomAjaxRequest()'メソッドは何ですか?あなたのajaxオプションは、 'data:JSON.stringify(dataObject)'、 'contentType: 'application/jsonである必要があります。 charset = utf-8 '、' –