Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
Uncaught DOMException: Failed to read the 'result' property from 'IDBRequest': The request has not finished

I'm binding data to 3 dropdowns by calling a method from another file of javascript. The data source of dropdown loading from IndexedDB. Data binding JS,

function bindStateData(){
     getMstStates("#state");
     getMstStates("#drstate");
     getMstStates("#cstate");
   }

Database manager js,

function getMstStates(state) {
    var request = indexedDB.open('AppDatabase', '3')
    request.onsuccess = function (e) {
        var dbInstance = e.target.result;
        let transaction = dbInstance.transaction("MstStates", "readonly");
        const statesDetailsStore = transaction.objectStore("MstStates");
        stateData = statesDetailsStore.getAll();
        stateData.onsuccess = function () {
            var MstStatesMap = new Object();
            var len = stateData.result.length,
            i;
            for (i = 0; i < len; i++) {
                MstStatesMap[i] = {};
                MstStatesMap[i].StateId = stateData.result[i].StateId;
                MstStatesMap[i].StateName = stateData.result[i].StateName;
            }
            callBackOptionItems(MstStatesMap, state);
        }
        stateData.onerror = function () {
            console.log('getMstStates : ' + e);
        }
     }
    request.onerror = function (e) { console.log('getMstStates : ' + e); }
}

function callBackOptionItems(MstOptionMap, objID) {
    for (var j in MstOptionMap) {
        var k, v
        var tem = 0;
        for (var i in MstOptionMap[j]) {
            if (tem == 0) {
                k = MstOptionMap[j][i]
            } else {
                v = MstOptionMap[j][i];
            }
            tem++
        }
        var el = $(objID);
        $(el).append('<option value="' + k + '">' + v + '</option>');

    }
    if (objID == '#select-history') {
        $("#select-history").append('<option value="4">Other</option>');
    }
}

When I tried to loading data I got the following error,

Uncaught DOMException: Failed to read the 'result' property from 'IDBRequest': The request has not finished.
    at IDBRequest.stateData.onsuccess

The same code logic was written in WebSQL, it was running properly, but unfortunately from iOS 13 version websql support has been revoked.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I have resolved this issue. The main culprit line is,

var len = stateData.result.length;

The correct code is as follows,

    var _request = statesDetailsStore.getAll();
    _request.onsuccess = function (event) {
        var MstStatesMap = new Object();
        var stateData = event.target.result;
    }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!