I have JSON values look like this
var results=[obj1,obj2,obj3];
and in
obj1['ádd':'usa','phone':121]
obj2['ádd':'cal','phone':143]
and so. on.
Here I want to print all obj's address and pass to HTML id element.
I have done this way but it is print the only the first value but in console printing all values.
for (var i = 0; i < results.length; i++) {
console.log(results[i].add);
var jjj=(results[i].add);
document.getElementById('target_2').innerHTML=jjj;
}
How to solve this problem?
['ádd':'usa','phone':121] obj2['ádd':'cal','phone':143]is supposed to mean. This is not valid JS. Did you mean{'ádd':'usa','phone':121}?