I return an array with my ajaxCall that looks like this: http://d.pr/i/ojR4
Inside the objects is Json (example: http://d.pr/i/aAM2) When i push this to my .hbs file (backbone) it's not possible to loop trough it, because it's an array, and it only accepts plain JSON.
Is there any way to convert this entirely to JSON?
My renderfunction in my view below:
render: function(){
var self = this;
var tripData;
console.log("[TripListView] render");
$.ajax({
url: Util.api + "/getalltrips",
type:"GET",
success: function(data){
console.log(data); // This is the output given
tripData = data;
}, error:function(){
console.log(arguments);
}
});
$('#container').html(this.template({trips: data}));
return this;
}