发帖方法:
function PostChartValues(meter_id, range_type_id, start_date, end_date) {
var values = $("#type_selection").val();
//values = expected values as string array
$.ajax({
url: '/Widget/GetMeterReadingsTimeSeries',
type: 'POST',
data: { MeterType: meter_id, DateRangeType: range_type_id, StartDate: start_date, EndDate: end_date, Parameters: values },
beforeSend: function () {
$("#chart_loading_div").show();
},
complete: function () {
$("#chart_loading_div").fadeOut();
$(".grids").jqGrid('GridUnload');
grid(meter_id, range_type_id, $("#start_date").val(), $("#end_date").val());
},
success: function (result) {
$("#chart").html(result);
},
error: function (result) {
alert("Seçilen kritere uygun veri bulunamadı!");
}
}); //end ajax
} //end PostChartValues
动作方法:
public ActionResult GetMeterReadingsTimeSeries(int MeterType, int DateRangeType, DateTime? StartDate, DateTime? EndDate,string[] Parameters)
{
// ...
return PartialView("_TimeSeries", chart);
}
我调试了它。只有参数数组为空。有没有其他方法可以用 jquery post 发布数组?
谢谢。