![]() |
How do I loop through this JSON?
The JSON that I get returned is this.
[{"name":"hpfa","addressLine1":"","addressLine2":"","town":"","county":"","postcode":"","contactName" :"","email":"","tel":"01442 766 285"},{"name":"hartford","addressLine1":"","addressLine2":"","town":"","county":"","postcode":"","co ntactName":"","email":"","tel":""},{"name":"hampshire","addressLine1":"","addressLine2":"","town":"" ,"county":"","postcode":"","contactName":"","email":"","tel":""}] I need to loop through it and add each of the name elements to a javascript array. How would i do this? |
Code:
|
since it is an array, I would advice to use a standard for() loop, not a for…in loop. anyways, there are also array methods to do the same.
PHP Code:
|
| All times are GMT +1. The time now is 03:17 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.