Karthik K

Karthik K

  • 1.2k
  • 449
  • 46.5k

How to pass the texbox value in webmethod in codebehind through ajax?

May 23 2024 7:59 AM

Hi All ,

        how to  pass the textbox value in webmethod in codebehind through ajax call method. 

sample method : 

 

$(function () {

   // var stDt = $("#txtStartDt").val();
    $.ajax({

        type: "POST",
        url: "InteractiveDashboard.aspx/Web_GetTotalSaleslist",
                
        data: "{'StartDate':'" + stDt + "','EndDate':'" + EndDt + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: OnSuccess,
        failure: function (response) {
            //alert(response.d);
            alert("Error..1");

        },
        error: function (response) {


            alert("Error..2");
            alert(response);
        }
    });
});

 


Answers (2)