If I send like this data: {CusCode:'5555', MktID: "aa"}
0=%7B&1=C&2=u&3=s&4=C&5=o&6=d&7=e&8=%3A&9=%20&10='&11='&12=%2C&13=M&14=k&15=t&16=I&17=D&18=%3A&19=%20&20='&21=a&22=a&23='&24=%7D
When I Use AJAX
HOW TO USE like this data: "{Field:'',Text:'',page:1,rows:50000}" and don't enclipe my code
$.ajax({ type: "POST",
contentType: "application/json; charset=utf-8",
url: "Service.asmx/M_Portfolio_selMaster",
dataType: "json",
data: "{Field:'',Text:'',page:1,rows:50000}",
async: true,
success: function (response) {
var data = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
var tbl;
data = data.rows;
if (data.length > 0) {
for (var i = 0; i < data.length; i++) {
tbl += "<OPTION value='" + data[i]['PortfolioID'] + "'>" + data[i]['PortfolioCode'] + "</OPTION>";
}
$("#s").html(tbl);
}
}
});
$("#grid").kendoGrid({
dataSource: {
transport: {
read: {
// the remote service url
url: "wsCRM.asmx/crm_FinancialBenefitByCustomer", // GetBBGToADVTransactionsData is our web method
contentType: "application/json; charset=utf-8",
type: "POST",
// JSONP is required for cross-domain AJAX
dataType: "json",
// additional parameters sent to the remote service
data: {
CusCode:'5555',
MktID: "aa"
}
}
}
}
});
My Web service asp.net C#
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string crm_FinancialBenefitByCustomer(string CusCode,string MktID)
{
CRMDataContext dtx = new CRMDataContext();
var data = dtx.crm_FinancialBenefitByCustomer(CusCode, MktID, UserID).ToList();
JavaScriptSerializer js = new JavaScriptSerializer();
string strJSON = js.Serialize(data);
//strJSON = "{\"__count\":\"" + data.Count + "\" ,\"results\":" + strJSON + "}";
return strJSON;
}