Json ajax data on a datatable Jquery -
i new jquery. have datatable data @ loading time. after searching data need remove data datatable , display searched data on table. cleared datatable using
app.common.genericajaxcall("post", '\getgroupsajax=true"', data, function(data) { datagrid = datagrid.fncleartable(); datagrid = $('#datagrid').datatable().fnadddata(data); alert('hidata'); }
but not giving correct result.
my json output is:
object { "aadata" : [{"id":37,"attemptid":1,"name":"group1","emailids":null,"type":"forward","status":1,"scheduledate":"03/10/2014 21:50 pm","sheduledby":null,"startdate":null,"enddate":null,"action":0}]}
there more 1 results on array. need display data. data json ajax call. how fix this. appreciate help
works me using initilisation:
json = '{ "aadata" : [{"id":37,"attemptid":1,"name":"group1","emailids":null,"type":"forward","status":1,"scheduledate":"03/10/2014 21:50 pm","sheduledby":null,"startdate":null,"enddate":null,"action":0}]}'; parsedjson= json.parse(json); var otable = $("#datatable").datatable(); otable.fncleartable(); $.each(parsedjson.aadata, function(key, value) { otable.datatable().fnadddata([ value.id, value.attemptid, value.name, value.emailids, value.type, value.status, value.scheduledate, value.sheduledby, value.startdate, value.enddate, value.action, ]); })
if object realy text of output, remove it:-)
Comments
Post a Comment