[jQuery] Re: How to print json data, key and value

2009-05-21 Thread Massimiliano Marini
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. -- Alan

[jQuery] Re: How to print json data, key and value

2009-05-20 Thread Massimiliano Marini
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 the

[jQuery] Re: How to print json data, key and value

2009-05-20 Thread chris thatcher
$.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 m...@linuxtime.itwrote: Hi Charlie, I'm not good at explaining the exact terms javascript definitions for value and key but

[jQuery] Re: How to print json data, key and value

2009-05-20 Thread Shawn
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] + br ); } This would output: p1 : v1 p2 : v2 Using the for..in loop structure, you can iterate over each of the properties of a given object. In this

[jQuery] Re: How to print json data, key and value

2009-05-19 Thread Charlie
$.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 terms _javascript_ definitions for "value and key" but they are