Hi Shawn,
> Native JS is capable of this sort of thing.
[snip]
> HTH And I hope this is what you were after.
Thanks so much for your explanation. Now it works. :)
--
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
"It's easier to invent the future than to predict it." -- Al
Native JS is capable of this sort of thing.
For instance:
var obj = { "p1": "v1", "p2": "v2" };
for (p in obj) {
document.write( p + " : " + obj[p] + "" );
}
This would output:
p1 : v1
p2 : v2
Using the "for..in" loop structure, you can iterate over each of the
properties of a given objec
$.each(data, function(index, item){
var name;
for(name in item){ console.log(name + " = " + item[name]);}
});
On Wed, May 20, 2009 at 5:51 AM, Massimiliano Marini wrote:
>
> Hi Charlie,
>
> > I'm not good at explaining the exact terms javascript definitions for
> > "value and key" but they a
Hi Charlie,
> I'm not good at explaining the exact terms javascript definitions for
> "value and key" but they are javascript identifiers? change it to
> what their values are in the array, works great
what I want to do is to print the "name" and the "value" of a json
object without knowing what
$.each(data,function(i) {
name = "name - " + data[i].name;
surname = "surname -" +data[i].surname;
age = "age -" + data[i].age;
console.log(name) etc...
});
I'm not good at explaining the exact te
5 matches
Mail list logo