$.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 _javascript_ identifiers? change it to what their values are in the array, works great Massimiliano Marini wrote: Hi all, from my PHP script with json_encode() I print this json output:[{"name":"pippo","surname":"pluto","age":"20"}] Is possible to print the key and the value of json object without using code like this: $.each(data, function(key, value){ console.log(value.name); console.log(value.surname); console.log(value.age); }); but something like: $.each(data, function(key, value){ console.log(key . '-' . value); }); and achieve output like this: name - pippo surname - pluto age - 20 |
- [jQuery] How to print json data, key and value Massimiliano Marini
- [jQuery] Re: How to print json data, key and valu... Charlie
- [jQuery] Re: How to print json data, key and ... Massimiliano Marini
- [jQuery] Re: How to print json data, key ... chris thatcher
- [jQuery] Re: How to print json data, key ... Shawn
- [jQuery] Re: How to print json data, ... Massimiliano Marini