2
我想要做的是將一個字符串/整數數組傳遞給mvc操作方法。 但數據總是返回爲空,我做錯了什麼?JQuery發佈數據到MVC操作方法?
MVC控制器
[HttpPost]
public ActionResult MyAction(List<string> ids)
{
// do something with array
// But it's null
return View();
}
JQuery的
$.post("/MyController/MyAction", JSON.stringify(ids), function() { alert("woohoo"); }, "application/json");
數據被派駐到行動結果
["156"]
我已經嘗試過了,仍然會返回爲空{「ids」:[「156」]} – aryaxt 2013-03-26 21:12:03
對不起,您還必須指定內容類型。更新答案。 – 2013-03-26 21:28:01
我已經在我的代碼中,我開始並行(虛擬機),現在一切正常。太ba我不能刪除問題 – aryaxt 2013-03-26 21:44:44