var request = new XMLHttpRequest() request.open('GET', 'json/azar.json', true) request.onload = function() { // begin accessing JSON data here var data = JSON.parse(this.response) var page = document.getElementById("home"); page.addEventListener("show", function(event){ var aleatorio = Math.floor(Math.random()*32); //var azar = document.getElementById("azar"); //var img = ons.createElement(``); document.getElementById("image").innerHTML = ``; //document.getElementById("Title").innerHTML = data[aleatorio].Renglones; document.getElementById("Content").innerHTML = data[aleatorio].Renglones + "
" + data[aleatorio].Artesano + "
" + data[aleatorio].Municipio; //azar.appendChild(img); }); } request.send()