locked
Discuss how you can use jQuery with your ASP.NET applications RRS feed

  • General discussion

  • Hi I am trying to populate a flexigrid with the results returned from a web service call.

    The web service method returns a json string in the format

    {"Response":[{"Total":1,"Status":"Success"},{"Total":4,"Status":"Success"},{"Total":6,"Status":"Success"}],"Status":1}

    when i call the flexigrid i get a syntax error parser error response and i'm not sure whether this is to do with the JSON returned or the way i am setting the parameters for the call.

    It would be great if someone could help as i've become a bit stuck

    var p = [
                            { name: 'username', value: 'test' },
                            { name: 'password', value: 'test' },
                            { name: 'StartDate', value: '2012-05-01 00:00' },
                            { name: 'EndDate', value: '' },
                            { name: 'FilterOption', value: 'Day' }
                    ]
                    //call the webservice method here
                    $("#flex1").flexigrid({
                        url: "http://localhost/testWS/test.asmx/GetTotals",
                        dataType: 'json',
                        params: p,
                        colModel: [
                            { display: 'Total', name: 'Total', width: 150, sortable: true, align: 'left' },
                            { display: 'Status', name: 'Status', width: 150, sortable: true, align: 'left' }
                            ],
                        searchitems: [
                            { display: 'Total', name: 'Total' },
                            ],
                        onError: function (jqXHR, textStatus, errorThrown) {
                            alert("flexigrid failed " + errorThrown + ": " + textStatus + ": " + jqXHR);
                        },
    
                        sortname: "AuthenticationTimestamp",
                        sortorder: "asc",
                        usepager: true,
                        title: "Usage Report",
                        useRp: true,
                        rp: 10,
                        showTableToggleBtn: false,
                        resizable: false,
                        width: 700,
                        height: 370,
                        singleSelect: true
                    }
                    );
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert("get session failed " + errorThrown);
                }
            });

    Thanks

    Tuesday, November 25, 2014 1:32 PM