php - jQuery $.get() Array Returns [object Object] -


test.php includes this:

echo json_encode( array(   array("name"=>"john","time"=>"2pm"),   array("name"=>"2","time"=>"1242pm"),   array("name"=>"j231ohn","time"=>"2p213m"), )); 

jquery:

$.get("test.php", function(data) {   $.each(data, function(n, val) {     alert(n + ': ' + val)   }); }, "json"); 

this result:

0: [object object] 1: [object object] 2: [object object] 

what doing wrong?

try:

alert(n + ': name = ' + val.name + ' time = ' + val.time); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -