Hi ,
I am using SQL server 2005 at my BackEnd and trying to retrieve data from server in the form of JSON. i validated the JSON and it's Valid. When i paste the JSON in file and try to access it, it's working fine.
Please find Below the code.
$(document).ready(function () {
// $.fn.dataTableExt.sErrMode = 'throw';
$('#testTable').dataTable({ "sPaginationType": "full_numbers", "bJQueryUI": true, "bProcessing": true, "bServerSide": true,
// "sAjaxSource": "/SupportApp/1.txt",
"sAjaxSource": "/SupportApp/Default.aspx/FetchFOIDetails",
"aoColumns": [
{ "mData": "ServiceOrderNo" },
{ "mData": "PcodeDesc" },
{ "mData": "Action" },
{ "mData": "Status" }
],
},
"error": function () { alert('error'); }
});
Server side code is :
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false, XmlSerializeString = true)]
//public static string FetchFOIDetails(string TaskID)
public static string FetchFOIDetails()
{
string str = "{\"aaData\" : [{\"ServiceOrderNo\":\"511121336727696846-3\",\"PcodeDesc\":\"Configure Admin Account in AccMan\",\"Action\":\"Cease\",\"Status\":\"CLOSE\"},{\"ServiceOrderNo\":\"511121336727696862-3\",\"PcodeDesc\":\"Configure Admin Account in AccMan for Toolkit\",\"Action\":\"Cease\",\"Status\":\"CLOSE\"},{\"ServiceOrderNo\":\"511121336727696866-8\",\"PcodeDesc\":\"Configure Admin Account in AccMan for Toolkit Access\",\"Action\":\"Cease\",\"Status\":\"CLOSE\"}]}";
return str;
}
Please help me!!!
I am using SQL server 2005 at my BackEnd and trying to retrieve data from server in the form of JSON. i validated the JSON and it's Valid. When i paste the JSON in file and try to access it, it's working fine.
Please find Below the code.
$(document).ready(function () {
// $.fn.dataTableExt.sErrMode = 'throw';
$('#testTable').dataTable({ "sPaginationType": "full_numbers", "bJQueryUI": true, "bProcessing": true, "bServerSide": true,
// "sAjaxSource": "/SupportApp/1.txt",
"sAjaxSource": "/SupportApp/Default.aspx/FetchFOIDetails",
"aoColumns": [
{ "mData": "ServiceOrderNo" },
{ "mData": "PcodeDesc" },
{ "mData": "Action" },
{ "mData": "Status" }
],
},
"error": function () { alert('error'); }
});
Server side code is :
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false, XmlSerializeString = true)]
//public static string FetchFOIDetails(string TaskID)
public static string FetchFOIDetails()
{
string str = "{\"aaData\" : [{\"ServiceOrderNo\":\"511121336727696846-3\",\"PcodeDesc\":\"Configure Admin Account in AccMan\",\"Action\":\"Cease\",\"Status\":\"CLOSE\"},{\"ServiceOrderNo\":\"511121336727696862-3\",\"PcodeDesc\":\"Configure Admin Account in AccMan for Toolkit\",\"Action\":\"Cease\",\"Status\":\"CLOSE\"},{\"ServiceOrderNo\":\"511121336727696866-8\",\"PcodeDesc\":\"Configure Admin Account in AccMan for Toolkit Access\",\"Action\":\"Cease\",\"Status\":\"CLOSE\"}]}";
return str;
}
Please help me!!!