Pulling object properties out of arrays and converting to string -


i working on chat app , stuck on getting properties out of array of objects. first sent ajax request json datatype. when check (data) parameter in success function in console shows array called results has 9 objects each 4 properties in them. looks this, except each has different id , text etc.

results: array[10] 0: object createdat: "2013-05-22t00:41:24.394z" objectid: "2tzxvbpwqa" text: "system: i'll back." updatedat: "2013-05

i want pull out text: each of objects, have no clue how this. i've searched , used many methods $grep , statements text out no avail(i new programming)

here sample code

function newfetch(newdisplay){     $.ajax({   url: 'https://api.parse.com/1/classes/chats',   data: null,   success: function(data){   /*alert('load performed.');*/    var text = $.grep(data, function(e) { return e.text == text});    newfetch(newdisplay(text));   } ,   datatype:"json" }); }; 

newdisplay in callback function appends passed parameter 1 of .divs.

this code snippet far seems no grab text instead returns [] when use console. appreciated!

json.prase friend

 success: function(data){     //...other success code might want run..     var newobjarray = {};     (var i=0; i<data.length; i++) {        newobjarray[i] = json.parse(data[i]);       }  } 

this should turn each entry in array objects well.

json.parse on mdn


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -