Ajax data-source (- Objekte) :TypeError: G is undefined

Arbeite ich an meiner ASP.Net web-Anwendung, wo ich zum Auffüllen einer HTML-Tabelle mit Ajax-Daten-Quelle, für die ich eine Verwendung von jQuery DataTables plugin.

HTML-code:

<table class="table table-striped table-hover table-bordered display" id="example" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Prctice Group Risk No
            </th>
            <th>Practice_Group
            </th>
            <th>Risk_Category
            </th>
        </tr>
    </thead>
</table>

JavaScript-Code:

$('#example').DataTable({
    "ajax": {
        "dataType": 'json',
        "contentType": "application/json; charset=utf-8",
        "type": "POST",
        "url":"index.aspx/Risky"
    },
    "columns": [
        { "data": "Prctice_Group_Risk_No" },
        { "data": "Practice_Group" },
        { "data": "Risk_Category" }]
});

Und hier ist meine Web-Methode, die ich bin, einen Anruf zu tätigen, um eine JSON-Antwort der Liste der Objekte

 [WebMethod]
 [ScriptMethod]
    public static string Risky()
    {
        return JsonConvert.SerializeObject(riskList);
    }

JSON-Antwort vom server:

d:"[{"Prctice_Group_Risk_No":1,"Practice_Group":"M&A","Risk_Category":"Conflicts of Interests"},{"Prctice_Group_Risk_No":2,"Practice_Group":"abc","Risk_Category":"Client Care and Communication"}]

Die JSON-Antwort zurückgegeben scheint in Ordnung für mich, wie beschrieben, in der offiziellen Seite von jquery DataTables
http://www.datatables.net/examples/ajax/objects.html

Aber keine Daten aufgefüllt wurde, in der Tabelle und ich bekomme die folgende Fehlermeldung in meinem Firebug-Konsole

TypeError: f ist undefiniert

Gelöst : Siehe funktionierende Lösung hier stackoverflow.com/a/54146071/9222769

InformationsquelleAutor umer | 2015-11-11

Schreibe einen Kommentar