我的json数据看起来像这样,
{"Table" : [{"accid" : "13","accname" : "Default","accountType" : "Default",
"noOfEmployes" : "","phone" : "","revenue" : "","webSite" : ""},
{"accid" : "15","accname" : "karpagam","accountType" : "Customer",
"noOfEmployes" : "60","phone" : "9894606677","revenue" : "","webSite" : ""},
{"accid" : "14","accname" : "VLB","accountType" : "Customer",
"noOfEmployes" : "60","phone" : "9865636371","revenue" : "","webSite" : ""},
{"accid" : "12","accname" : "XIT","accountType" : "Customer",
"noOfEmployes" : "20","phone" : "4347980","revenue" : "1000000",
"webSite" : "xavyinfotech.com"}]}
现在我有一个文本框account name
,我的用户可以在其中输入任何字符D,d,kar
等帐户名称,现在我想将该文本与我的json数据的accname
个键匹配。我的过滤器可能会产生'n'个结果。任何建议使用jquery过滤json数据?
修改
我应该依赖jslinq之类的其他库吗?
答案 0 :(得分:2)
不需要jQuery。
for (el in data.Table) {
if (somecondition(el.accname) {
dosomethingwith(el);
}
}