Mi problema es que opcion1.html si lo ejecuto solo, genera una base de datos sqlite y la muestra en una lista sencilla, pero si ejecuto el index, y llamo a opcion1, este no la muestra. Que pasa cuando llamo a opcion1 que no muestra nada ? Gracias !!!
index.html
<li><a href="opcion1.html" data-role="button" data-icon="search" data-iconpos="notext">Personas</a></li>
opcion1.html
<!DOCTYPE html>
<html>
<head>
<title>personal de la GAyF</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript" src="js/jquery-1.11.2.min.js"/></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="js/cordova.js"></script>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
var db = window.openDatabase("GayF", "1.0", "GayF personas", 800000);
db.transaction(populateDB, errorCB, successCB);
}
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS SoccerPlayer');
tx.executeSql('CREATE TABLE IF NOT EXISTS SoccerPlayer (id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL, Club TEXT NOT NULL)');
tx.executeSql('INSERT INTO SoccerPlayer(Name,Club) VALUES ("Alexandre Pato", "AC Milan")');
tx.executeSql('INSERT INTO SoccerPlayer(Name,Club) VALUES ("Van Persie", "Arsenal")');
}
function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
function successCB() {
alert("Ok el insert");
var db = window.openDatabase("GayF", "1.0", "GayF personas", 800000);
db.transaction(queryDB,errorCB);
}
function queryDB(tx){
tx.executeSql('SELECT * FROM SoccerPlayer',[],querySuccess,errorCB);
}
function querySuccess(tx,result){
$('#SoccerPlayerList').empty();
for(index=0;index<result.rows.length;index++)
{
var row = result.rows.item(index);
$('#SoccerPlayerList').append('<li><a href="#"><h3 class="ui-li-heading">'+row['Name']+'</h3><p class="ui-li-desc">Club '+row['Club']+'</p></a></li>');
}
$('#SoccerPlayerList').listview();
$('#SoccerPlayerList').listview('refresh');
$('#SoccerPlayerList').listview().listview('refresh');
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed" data-theme="b">
<h1>Jugadores</h1>
</div>
<div data-role="content">
<ul id="SoccerPlayerList">
</ul>
</div>
</div>
</body>
</html>