Jquery Datatables with asp.net asmx web services
Jquery Datatables with asp.net asmx web services
almighty
Posts: 8Questions: 0Answers: 0
Hi,
I know there are lot of post already there related to this but i am newbie who tried help from those post but in vain.
I have asmx web which i am able to call through my normal jquery ajax call.
this is how my service looks like.
[code]
[WebMethod]
public List GetExpiryRules(string culture, string affiliateId, string selectedPackages, string intervals)
{
CatalogBl objCatalogBl = new CatalogBl();
AffiliateInfo affinfo = objCatalogBl.GetAffiliate(int.Parse(affiliateId), true);
string accurevUserName = ConfigurationManager.AppSettings["AccurevUserName"];
string sourceStream = ConfigurationManager.AppSettings["AccurevSourceStream"];
string affiliate = affinfo.AffiliateCode;
Boolean l_IsExists = FileExistanceValidator.DoesThisFileExist(culture, affiliate, affiliateId);
[/code]
and this is how how my client code looks like
[code]
$('#getExpiryRules').live('click', function () {
$('#expiryRulesDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": '../Services/WebServices.asmx/GetExpiryRules',
"sAjaxDataProp": "d", "sPaginationType": "full_numbers", "bDestroy": true, "bAutoWidth": false,
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "culture": "en-us", "affiliateId": 0, "selectedPackages": "selectedPackages", "intervals": "intervals" });
$.ajax({
type: "POST",
data: aoData,
dataType: "json",
url: sSource,
contentType: "application/json; charset=utf-8",
success: success
});
function success(json) {
fnCallback(json);
}
}
});
[/code]
1. i am using jquery-1.6.4.min.js version.
2. the response from the service is not json serialised yet (will do it after atleast services get hit)
3. what am i doing wrong here
4. the error that i get on the firefox console is {"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}
Any help or guidance in the right direction would be much appreciated.
I know there are lot of post already there related to this but i am newbie who tried help from those post but in vain.
I have asmx web which i am able to call through my normal jquery ajax call.
this is how my service looks like.
[code]
[WebMethod]
public List GetExpiryRules(string culture, string affiliateId, string selectedPackages, string intervals)
{
CatalogBl objCatalogBl = new CatalogBl();
AffiliateInfo affinfo = objCatalogBl.GetAffiliate(int.Parse(affiliateId), true);
string accurevUserName = ConfigurationManager.AppSettings["AccurevUserName"];
string sourceStream = ConfigurationManager.AppSettings["AccurevSourceStream"];
string affiliate = affinfo.AffiliateCode;
Boolean l_IsExists = FileExistanceValidator.DoesThisFileExist(culture, affiliate, affiliateId);
[/code]
and this is how how my client code looks like
[code]
$('#getExpiryRules').live('click', function () {
$('#expiryRulesDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": '../Services/WebServices.asmx/GetExpiryRules',
"sAjaxDataProp": "d", "sPaginationType": "full_numbers", "bDestroy": true, "bAutoWidth": false,
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "culture": "en-us", "affiliateId": 0, "selectedPackages": "selectedPackages", "intervals": "intervals" });
$.ajax({
type: "POST",
data: aoData,
dataType: "json",
url: sSource,
contentType: "application/json; charset=utf-8",
success: success
});
function success(json) {
fnCallback(json);
}
}
});
[/code]
1. i am using jquery-1.6.4.min.js version.
2. the response from the service is not json serialised yet (will do it after atleast services get hit)
3. what am i doing wrong here
4. the error that i get on the firefox console is {"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}
Any help or guidance in the right direction would be much appreciated.
This discussion has been closed.
Replies
[code]
sEcho=1&iColumns=5&sColumns=&iDisplayStart=0&iDisplayLength=10&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&undefined=undefined
[/code]
why the last attribute is undefined and are we supposed to have all these attributes at the server side too.
[quote]Requested unknown parameter '1' from the data source for row 0[/quote]
My json response coming from asp.net webservice is
[code]
"[{"Age":1,"Name":"amit","Surname":"amittest"},{"Age":1,"Name":"amit","Surname":"amittest"},{"Age":1,"Name":"amit","Surname":"amittest"},{"Age":1,"Name":"amit","Surname":"amittest"},{"Age":1,"Name":"amit","Surname":"amittest"}]"
[/code] which seems to be correct as its an array of objects. Can anyone guide me here?