C# webform 在aspx页面调用aspx.cs页面的方法

前台代码

--调用后台的GetEcharts1方法,并传入三个参数
startDateValue,ipEndDate,ddlTypeValue
<input type="button" id="loadExce2l" value="查看" onclick="loadEcharts()" />

function loadEcharts() {
console.log(19999999999)
var startDateValue = document.getElementById("ipStartDate").value;
var ipEndDate = document.getElementById("ipEndDate").value
var ddlTypeValue = document.getElementById('ddlType').value;


 $.ajax({
                url: "frmCIMES_IQCWeeklyAndMonthlyReports.aspx/GetEcharts1",
                type: "POST",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: JSON.stringify({
                    startDateValue: startDateValue,
                    ipEndDate: ipEndDate,
                    ddlTypeValue: ddlTypeValue
                }),
                success: function (response) {
                    console.log(17777777772222222)
                    var lists = response.d;
},
                error: function (err) {
                    console.log(1666666666666)
                    console.log(err)
                    alert(err);
                }
            });
}

 

后台代码

   [WebMethod(EnableSession = true)]
    public static List<List<object>> GetEcharts1(string startDateValue, string ipEndDate, string ddlTypeValue)
    {  string strStartDate = startDateValue.Trim();
            string strEndDate = ipEndDate.Trim();
            string strTypeValue = ddlTypeValue;
            string jsonData = string.Empty;
}

 

posted on 2024-05-21 08:26  写个笔记  阅读(32)  评论(0编辑  收藏  举报

导航