samedi 27 décembre 2014

Keep getting [object, Object] from array for $.each


I keep getting [object, Object] from array for $.each when i try and alert it. Below is the code I am using, I have tried several different ways but this seems to be the way that works the best.


Could someone please help me out



var min_chats = [];

$(function(){

$(".append_chat").click(function(){
var chatid = $(this).attr('alt');
var data = $(this).attr('data');
min_chats.push({
"chatid": chatid,
"data": data
});
});

$("#max_close").live( "click", function() {
var chatid = $(this).attr('alt');
var data = $(this).attr('data');

$.each(min_chats, function(key,val) {
alert(key+val);
});

});

});




Aucun commentaire:

Enregistrer un commentaire