[FIXED] App.request.json - phonegap

Hi there,

I have an issue only in phonegap with Virtual List with a json. It’s working fine in browsers but in phonegap no data is showed.

test json:
[[“2”,“bb”,“2018-01-01”,“2018-12-01”,“bb”],[“1”,“aa”,“2018-01-01”,“2018-12-01”,“aa”]]

$$(document).on(‘page:afterin’, ‘.page[data-name=“ver_obras”]’, function (e) {

var json_req = ‘http://xxxx/test.php’;

var array_json;
app.request.json(json_req, function (data) {

	var items=data.length;
	var self = this;
	var items = [];
	for (var i = 0; i <= data.length-1; i++) {
		items.push({
		title: data[i][1],
		subtitle: '# '+ data[i][0] + ' - Fecha Inicio: ' +data[i][2] + ' - Fecha Fin: ' +data[i][3],
		id_obra: data[i][0]
			
		});
	}
	var virtualList = app.virtualList.create({
		// List Element
		el: '.virtual-list',
		// Pass array with items
		items: items,
		// Custom search function for searchbar
		searchAll: function (query, items) {
			var found = [];
			for (var i = 0; i < items.length; i++) {
				if (items[i].title.toLowerCase().indexOf(query.toLowerCase()) >= 0 || query.trim() === '') found.push(i);
			}
			return found; //return array with matched indexes
		},
		// List item Template7 template
		itemTemplate:
			'<li id="vo" data-id-obra={{id_obra}}>' +
				'<a href="#" class="item-link item-content">' +
					'<div class="item-inner">' +
						'<div class="item-title-row" >' +
						'<div class="item-title" id="title">{{title}}</div>' +
					'</div>' +
					'<div class="item-subtitle">{{subtitle}}S</div>' +
					'</div>' +
				'</a>' +
			'</li>',
		// Item height
		height: app.theme === 'ios' ? 63 : 73,
	});
});

Any suggestion?

Thanks

Solution found. Headers in the PHP file were not correct.

Thanks