IndexedDB function is not working in Intel XDK -


i have made web app calls 2 indexeddb databases , when click button saves value , goes page.

it works perfect web app when try use intel xdk shows in console: "uncaught typeerror: cannot set property 'varbusquedapam' of undefined". javascript:

var indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb;         var database = null;         var bdbusqueda = null;          function iniciarbd() {             database = indexeddb.open('bdbeta', 4);              database.onupgradeneeded = function (e) {                 var active = database.result;                 var objetoproductos = active.createobjectstore("productos", {keypath: 'id', autoincrement: true});                 objetoproductos.createindex('nombre_producto', 'producto', {unique: true});             };              database.onsuccess = function (e) {                 varbusqueda();             };             database.onerror = function (e) {                 alert('error al cargar la base de datos');             };         }          function varbusqueda() {             bdbusqueda= indexeddb.open('bdbeta2', 1);              bdbusqueda.onupgradeneeded = function (e) {                 var active = bdbusqueda.result;                 var objetolista = active.createobjectstore("variablebusqueda", {keypath: 'id', autoincrement: true});                 objetolista.createindex('variable_de_busqueda_producto', 'varbusquedapam', {unique: true});                 objetolista.createindex('variable_de_busqueda_marca', 'varbusquedamam', {unique: true});                 objetolista.createindex('variable_de_busqueda_modelo', 'varbusquedamai', {unique: true});             };              bdbusqueda.onsuccess = function (e) {                 //do nothing             };             bdbusqueda.onerror = function (e) {                 alert("hubo un problema al conectar la base de datos");             };         }          function irmarcas(id){             var active = bdbusqueda.result;             var data = active.transaction(["variablebusqueda"], "readwrite");             var object = data.objectstore("variablebusqueda");             var request = object.get(1);              request.onsuccess = function() {                 var data = request.result;                  data.varbusquedapam = id; // <---here error shown                  var consultaactualizar = object.put(data);                 consultaactualizar.onsuccess = function() {                     window.location.href = "marca.html";                 };             };         } 

and call function "irmarcas(id)" form html tag:

<input type="button" id="tm" value="tarjetas madre" onclick="irmarcas(this.id);"> 

i did similar projects in past same functions (indexeddb) , never got errors before. in case version of intel xdk 3088.

did forgot something?

thank all.

the error means data variable undefined. data variable undefined because object.get(1) did not match objects in object store.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -