javascript - Bootgrid populate from aspx.cs -
i'm trying populate bootgrid via ajax call webmethod in code behind file. gets returned call though page html.
here javascript use call:
$("#grid-data").bootgrid({ ajax: true, requesthandler: function (request) { return request; }, url: "default3.aspx/getdata" }); and here c# webmethods:
[webmethod] public static string getdata() { databaseapi db = new databaseapi(); datatable data = db.getreportstatus(2080); string jsonresult = jsonconvert.serializeobject(data); jsonresult = "{\"current\":1, \"rowcount\": 10, \"rows\": " + jsonresult + ",\"total\": " + data.rows.count + "}"; return jsonresult; } when debug in visual studio, webmethod never gets called. tested using regular jquery ajax call , works fine, returns json in correct format:
function test() { return $.ajax({ type: "post", url: "default3.aspx/getdata", contenttype: "application/json; charset=utf-8", datatype: "text", success: function (result) { alert(result); }, error: function (xmlhttprequest, textstatus, errorthrown) { errors += textstatus + " - " + errorthrown + "\n\r"; alert(errors); } }); } also tried parsing json string when it's returned using test method , appending bootgrid, again doesnt work. nothing happens, no error.
any appreciated.
Comments
Post a Comment