I've got this JSON object:
({a1:-1,a2:null, messages:[{b1:message1, b2:message2, b3:message3, ... }]})
How do I loop through the messages pairs using jQuery's .each (without hardcoding the b1,b2,b3,message1,message2,message3).
I've got this JSON object:
({a1:-1,a2:null, messages:[{b1:message1, b2:message2, b3:message3, ... }]})
How do I loop through the messages pairs using jQuery's .each (without hardcoding the b1,b2,b3,message1,message2,message3).
Start by reading the reference for jQuery.each(). Here's an apt example from the reference:
$.each({ name: "John", lang: "JS" }, function(k, v) {
alert( "Key: " + k + ", Value: " + v );
});