I want to transfer part of the data from the server database in json format and then write it to the browser database. I read, there is IndexedDB and a SQL Web database. Which one to choose? Please tell me examples, how to do it from the very beginning to the working state, and then I find something only code fragments.
Thank.

Closed due to the fact that the issue is too general for the participants D-side , Mirdin , Streletz , Bald , Denis Sep 5 '16 at 6:51 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    Description here http://www.onlywebpro.com/2012/12/23/html5-storage-indexeddb/

    Code example

    <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>IndexedDb Demo | onlyWebPro.com</title> <script type="text/javascript"> //prefixes of implementation that we want to test window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; //prefixes of window.IDB objects window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction; window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange if (!window.indexedDB) { window.alert("Your browser doesn't support a stable version of IndexedDB.") } const customerData = [ { id: "00-01", name: "Bill", age: 35, email: "bill@company.com" }, { id: "00-02", name: "Donna", age: 32, email: "donna@home.org" } ]; var db; var request = window.indexedDB.open("newDatabase", 1); request.onerror = function(event) { console.log("error: "); }; request.onsuccess = function(event) { db = request.result; console.log("success: "+ db); }; request.onupgradeneeded = function(event) { var db = event.target.result; var objectStore = db.createObjectStore("customers", {keyPath: "id"}); for (var i in customerData) { objectStore.add(customerData[i]); } } function read() { var transaction = db.transaction(["customers"]); var objectStore = transaction.objectStore("customers"); var request = objectStore.get("00-03"); request.onerror = function(event) { alert("Unable to retrieve daa from database!"); }; request.onsuccess = function(event) { // Do something with the request.result! if(request.result) { alert("Name: " + request.result.name + ", Age: " + request.result.age + ", Email: " + request.result.email); } else { alert("Kenny couldn't be found in your database!"); } }; } function readAll() { var objectStore = db.transaction("customers").objectStore("customers"); objectStore.openCursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { alert("Name for id " + cursor.key + " is " + cursor.value.name + ", Age: " + cursor.value.age + ", Email: " + cursor.value.email); cursor.continue(); } else { alert("No more entries!"); } }; } function add() { var request = db.transaction(["customers"], "readwrite") .objectStore("customers") .add({ id: "00-03", name: "Kenny", age: 19, email: "kenny@planet.org" }); request.onsuccess = function(event) { alert("Kenny has been added to your database."); }; request.onerror = function(event) { alert("Unable to add data\r\nKenny is aready exist in your database! "); } } function remove() { var request = db.transaction(["customers"], "readwrite") .objectStore("customers") .delete("00-03"); request.onsuccess = function(event) { alert("Kenny's entry has been removed from your database."); }; } </script> </head> <body> <button onclick="read()">Read single data from indexedDb</button> <button onclick="readAll()">Read all data from indexedDb</button> <button onclick="add()">Add data to indexedDb</button> <button onclick="remove()">Delete data from indexedDb</button> </body> </html>