I have the following javascript code for an autoselect dropdownlist with multiselect checkbox:
function f() {
var data;
$("#csrch").attr('value', '');
$.ajax
({
//calling aspx web method
url: 'drpCtrl.aspx/CustomerFilter',
type: 'POST',
//since webmethod does not have parameter given data as empty
data: '',
datatype: 'json',
contentType: 'application/json',
mimeType: 'application/json',
error: function (jqxhr, status, error) {
alert(error)
}
});
}
Which is calling this web method from the code behind page
[WebMethod]
public string CustomerFilter()
{
string result = "";
//retrieving customer list from database where it returns as json format
result = Convert.ToString(objSLA.ExecuteScalar (CommandType.StoredProcedure, "Usp_Get_Customer_Test"));
//returning string format
return result;
}
Webmethod CustomerFilter() is not calling and I am getting the Internal Server Error..Please help what is wrong in above said coding result:
{
"uin":{
"customer":[
{
"i":"1",
"n":"Ahold Financial Services"
},
{
"i":"2",
"n":"ALM"
},
{
"i":"3",
"n":"Associated Global Systems, Inc."
}
]
}
}