asp.net - Jquery Datatables Ajax Response -
I am trying to follow the example data for Ajax data source (objects). I am using asp.net and I have the following handler that receives my data, processes it and provides feedback.
Public class user handlers: IHttpHandler {Private prong string JsHeader = @ "{{" "" "data" "{0}}}"; Public Zero Processing Request (HTTP Reference Reference) {IEnumerable & lt; SystemUser & gt; Data = system urological Load all system resources (); & Lt; SimpleUser & gt; Userlist = new list & lt; SimpleUser & gt; (); Forex currency (data in SystemUSSR) {Simple User Simple = New Simple User (); easy. Id = su.Id; easy. Full name = suNameFirst; easy. Email = "example@email.co.uk"; Userlist.Add (simple); } String json = JsonConvert.SerializeObject (userlist, formatting.indent); Context.Response.ContentType = "text / plain"; Context.Response.ContentEncoding = encoding.UTF8; Context.Response.Cache.SetNoStore (); Context.Response.Expires = -1; Context.Response.Write (String.Format (JSHD, JSN)); } which provides the right response while capturing it in the browser and viewing data through network traffic. The following are in my ASPX page.
$ ('# table_id'). {"Data": "email"}, {"data": "full name"}, {"data": "email"}, {"ajax": '/ handlers_new userholder.', 'Column' "Data": "key resource"}]}); However when the page loads, I get this error:
DatabaseBase Warning: Table ID = Table_ID - Invalid JSON response. For more information about this error, please see
Outputed data looks like this,
{"data" [{"" Id: 1, " "Full name": "administrator", "email": "example@email.co.uk", "key resource": wrong}, {"id": 2, "fullname": "John", "email": "example @email.co.uk "," keyResource " }, Etc ... .. Please tell me why I am getting this error. Should I add a Jason object differently, or am I missing something with the jazzy dataset?
I have been able to correct my problem surprisingly. I ran my code through that and it came to know that I was missing the "::" in my JSD so what did I have:
Private contact string JsHeader = @ "{ {"" "" Data "" {0}} "; And now what works now is:
Private Constring string JsHeader = @ "{{" "Data" ": {0}}}"; Hope that any other such is facing any similar problem.
< / Div>
Comments
Post a Comment