I want to pass three values from jquery to web method in my form.i m using the following code.But its not working..Am i using the correct syntax to pass the values?
var frm = $('#txtFromDate').val();
var to = $('#txtToDate').val();
var suppress = 'No';
$(document).ready(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "ProfitAndLoss.aspx/BindDatatable",
//data:JSON.stringify({ frm: $('#txtFromDate').val() },{ to: $('#txtToDate').val() },{ suppress: "No" }),
data: "{'frm': '" + frm + "','to': '" + to + "','suppress': '" + suppress + "'}",
dataType: "json",
async: true,
success: function(data) {
for (var i = 0; i < data.d.length; i++) {
$("#grdPandL").append("
" + data.d[i].UserId + " | " + data.d[i].UserName + " | " + data.d[i].Location + " |
");
}
},
error: function(result) {
alert("Error");
alert(data.d[i]);
}
});
});