javascript - AJAX Get from a JSON Tree -


i'm starting out ajax, trying use jquery's $.getjson function (or related, ie $.load(), $.ajax(), etc). have json file structure this:

[     {         "id": 1,         "email": "user@domain.com",         "password": "password"     },     {         "id": 2,         "email": "one@two.com",         "password": "password"     } ] 

how can call on json file (let's call users.json) user specific email? thought second paramter in $.getjson, seems return whole tree.

thanks!

short answer - can't directly ajax. jquery can extract portions of html , xml documents, not json.

easiest answer - retrieve entire object (you have to, anyway) , use jsonpath structure want

longer answer - retrieve entire object, , traverse object want

best answer - make email address parameter whatever script produces json , have server return data want.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -