1
這裏是我創建以產生陣列的acript:使用ASP.NET MVC的Ajax數組後?
var data_points = $("#bcc_datapoint_selection").find("input:checked").map(function() {
return $(this).val();
}).get();
控制檯日誌輸出:
["3","4","6"]
Ajax的後腳本:
$.ajax({
url: '@Url.Action("BccGetMeterReadingsChart", "Widget")',
type: 'POST',
data: { dataPoints: data_points },
success: function (result) {
$("#bcc_chart").html(result);
},
error: function() {
alert("Seçilen kritere uygun veri bulunamadı!");
}
}); //end ajax
控制器方法:
public ActionResult BccGetMeterReadingsChart(string[] dataPoints)
{
// Some code
return Json("", JsonRequestBehavior.AllowGet);
}
調試輸出:
dataPoints : null
請求數據輸出:
dataPoints%5b%5d=3&dataPoints%5b%5d=4&dataPoints%5b%5d=6
我缺少什麼?這是Ajax函數中的問題嗎?還是另一個問題?
你需要寶貴的幫助** [這裏](http://stackoverflow.com/questions/14743271/how-can-i-modify-my-below- mentioned-code-to-display-the-same-validation - 消息)** – SMC
非常感謝... –