I have a javascript object (I actually get the data through an ajax request):
var data = {};
I have added some stuff into it:
tempData.push( data[index] );
I agree with the correct answer above, but.... your still not giving the index value for the data that you want to add to tempData. Without the [index] value the whole array will be added.