In you current code, the value is an object, however, alert can only display string, so it'll use .toString to convert your value to a string, which then becomes "[Object Object]".
To display the value as key-value pairs use JSON.stringify(value) to make it a json again:
success: function(response){
console.log(response);
if(response.success){
$.each(response.vote, function(index, value){
alert(JSON.stringify(value));
});
}
}
if you just want to access the attributes of the value, use their key should work:
success: function(response){
console.log(response);
if(response.success){
$.each(response.vote, function(index, value){
// This will alert each items' `bundle` value.
// It's enough in your case, but you may have to check if the target attribute you want to alert is also an object.
alert(value.bundle);
});
}
}
valueis anobject, alert will make it a string, which impies a .toString on value, so you gets[Object Object]. You can tryalert({})which gives you the same result. If you just want to see that key-value pairs, you can make it ajsonagain,alert(JSON.stringify(value)), but if you just want to access it's values, usevalue.branch... etc is ok.alertcasts the objects to string, ThetoStringmethod on the GrandParentObjectclass is called using prototype-chain, so it alerts[object Object]. Useconsole.log.