I started working with the LungoJS mobile framework. I and javascript are not working fine, but really I want to change this original code:
ORIGINAL.JS
var mock = function() { var mock = []; for (var i=1; i<=5; i++){ mock.push({ id: i, name: 'name n'+i, description: 'description n'+i }) } lng.View.Template.List.create({ container_id: 'lives', template_id: 'show_music_template', data: mock }) } return { mock: mock } })(LUNGO, App);
This original code works fine, and it's easy, now I want to execute a request using $ .get, which returns a JSON file and populates the array like ORIGINAL.JS:
JSON RESULT:
{"result":[ {"id":"52","username":"jgali","image":"Prova_(live)387.jpeg","name":"Prova (live)","type":"music","language":"Catalan","category":"8","tags":"indie, dine prova, indie live","description":"Aquesta es una prova online de reidiou","licence":"Reidiou License","played":"54","record_time":"45","facebook_id":"1052266203_2342869925158","twitter_hash":"#Provalive","create_date":"2011-11-01 13:04:21"}, {"id":"52","username":"jgali","image":"Prova_(live)387.jpeg","name":"Prova (live)","type":"music","language":"Catalan","category":"8","tags":"indie, dine prova, indie live","description":"Aquesta es una prova online de reidiou","licence":"Reidiou License","played":"54","record_time":"45","facebook_id":"1052266203_2342869925158","twitter_hash":"#Provalive","create_date":"2011-11-01 13:04:21"} ]}
SERVICE.JS
var mock = function() { var mock = []; var url = 'http://localhost/app/rest/podcasts'; var data = {};
The problem is the outer loop. I can not use the "mock" array. Of course, I make a few mistakes ... but does anyone know what the problem is?
Thanks.