I have a JSON string being returned from PHP that looks exactly like this:
[CODE]{“id”:”1″,”name”:”Bill Johnson”,”age”:”23″,”experience”:”7″,”dept”:”Web Developer”}{“id”:”3″,”name”:”Bob Smith”,”age”:”48″,”experience”:”26″,”dept”:”Lawyer”}
I’m searching an employee database by name, so “Bill Johnson” and “Bob Smith” will both show up if you just type “B”. That’s the JSON string that’s being returned, but I don’t know the syntax to iterate through each object and get all the values. Currently nothing displays until there is only ONE result, because this is my code:
[CODE]var result = “”;
result += data.name+”<br />”;
result += “Employee ID: “+data.id+”<br />”;
result += “Age: “+data.age+”<br />”;
result += “Experience: “+data.experience+” years <br />”;
result += “Department: “+data.dept+”<br />”;
I want this to be able to display up to 10 employees whose names match what you’re typing.