开发者

Filter json data using jquery?

开发者 https://www.devze.com 2023-01-13 22:15 出处:网络
My json data looks like this, {\"Table\" : [{\"accid\" : \"13\",\"accname\" : \"Default\",\"accountType\" : \"Default\",

My json data looks like this,

{"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"}]}

Now I have a textbox account name where my user can enter an account name like D,d,kar any character and now I want to match that text to my accname keys of my json data. My filter may produce 'n' number of results.. Any suggestion to Filter json data using jquery?

EDIT:

Should I depend on other libraries like jslinq to do so?


No need for jQuery.

for (el in data.Table) {
  if (somecondition(el.accname) {
    dosomethingwith(el);
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消