I have a table with population of the JSON file, everything is working till now, but I have to leave those items What am I trying to do is the value of 0 for a key named "Member_count"?
This code is:
$ mygroupstable = $ ('# my_groups_table'); $ .ajax ({url: 'http://testingsite.com/jsondata/mygroups.json', datatype: 'Jason', success: function (data) {$ .each (data.groups, function (key, val) {$ Mygroupstable.append ('& lt; tr & gt; & lt; td & gt; & lt; input type = "checkbox" category = "group selector" member_quality = "' + val.member_count + '" value = " '+ Val.value +' "Id =" '+ val.id +' "name =" '+ val.name +' "group_name =" '+ val.group_name +' ""> > gt; & lt; / td & Gt; & lt; td style = "width: 10px; & lt; / td> & lt; td & gt; & lt; label =" '+ val.id +' "& gt; '+ Val.group_name + '& lt; / labels & gt; & lt; / td & gt; & lt; / tr & gt;;);}}}}}};
JSON file looks like this:
{"groups": [{"id": "data1 ",", "Name_count": "1" "value": "255", "name": "data []", "group_name": "group1"}, {"id": "data2", "member_count" "5", "value": "256", "name": "data []", "group_name": "group2"}, {"id": "data 3", "member_count": "4" "Value": "", "name": "data", "data []", "group_name": "group 3"}, {"id": "data4", "member_count": "6", "value": " "Data", "name": "data", "data []", "group", "group", "group", "group_name": "group 5"}]}
In this scenario, group 5 should not be added to the table. << P>
Try this:
var $ Mygroupstable = $ ('# my_groups_table'); Var url = 'http://testingsite.com/jsondata/mygroups.json.json'; $ .getJSON (URL, Function (Data) {$ .ईईई (DataGroup, Function (Key, Val) {if (Val member_col! == "0") {$ mygroupstable.append ('& lt; tr & gt; & Lt; td & gt; & lt; input type = "checkbox" class = "groupselector" member_count = "val.member_count + '" value = "' + val.value + '" id = "' + val.id + '"Name ="' + Val.name + "" group_name = "'+ val.group_name +'" /> gt; & lt; / td & gt; & lt; td style = "width: 10px;" & Gt; & lt; / td & gt; & lt; td & gt; & lt; label = "'+ val.id +'" & gt; '+ val.group_name +' & lt; / label & gt; ; & Lt; / td> & lt; / tr & gt; ';)}}})}};
Comments
Post a Comment