Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/07/2014, 13:50
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 12 años
Puntos: 320
Respuesta: Base de datos en phonegap

Parece que justo cambiaron los links porque el que habia puesto lleva a la home, el codigo que tengo es este:
Código html:
Ver original
  1. <!DOCTYPE html>
  2.   <head>
  3.     <title>Example</title>
  4.  
  5.     <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
  6.     <script type="text/javascript" charset="utf-8">
  7.  
  8.     // Wait for PhoneGap to load
  9.     //
  10.     document.addEventListener("deviceready", onDeviceReady, false);
  11.  
  12.     // PhoneGap is ready
  13.     //
  14.     function onDeviceReady() {
  15.         var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
  16.         db.transaction(populateDB, errorCB, successCB);
  17.     }
  18.  
  19.     // Populate the database
  20.     //
  21.     function populateDB(tx) {
  22.          tx.executeSql('DROP TABLE IF EXISTS DEMO');
  23.          tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
  24.          tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
  25.          tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
  26.     }
  27.  
  28.     // Transaction error callback
  29.     //
  30.     function errorCB(tx, err) {
  31.         alert("Error processing SQL: "+err);
  32.     }
  33.  
  34.     // Transaction success callback
  35.     //
  36.     function successCB() {
  37.         alert("success!");
  38.     }
  39.  
  40.     </script>
  41.   </head>
  42.   <body>
  43.     <h1>Example</h1>
  44.     <p>Database</p>
  45.   </body>
  46. </html>

El codigo esta bien, porque si lo ejecuto en chrome onDeviceReady() desde la consola se ejecuta y anda perfecto, el tema es que en la app no funciona, al instalar no me pide permisos de almacenamiento, quizas sea por eso, pero no encuentro como habilitaselo
__________________
Maratón de desafíos PHP Junio - Agosto 2015 en FDW | Reglamento - Desafios