jeudi 24 mars 2016

Cordova sychron db lite with the serveur

i find this tuto " tuto cordova sqlite" but not working.

i have create a php in server :

[{"id":"1","ref":"ref1","desg":"produit1","code":"code barre 01","qte":"10","depot":"1","qtein":"0"},{"id":"2","ref":"ref2","desg":"produit2","code":"code barre 02","qte":"20","depot":"1","qtein":"0"}]

in the html cordova:

       <a target="_blank" href="javascript:sly()" style="text-decoration: none"><button>Sy Lite to Serveur</button></a>
      var db = null;
      document.addEventListener("deviceready", function(){
        db = window.sqlitePlugin.openDatabase({name: "testdb.db"});
        db.transaction(function(tx) {
            tx.executeSql("CREATE TABLE tt (data)");
        }, function(err){
            alert("An error occured while initializing the app");
        });

        }, false);
        function sly()
      {
       $.ajax({url: "http://url/JsonData.php",
       dataType: "json",
       async: true,
       success: function (result) {
        alert ('er'.JSON.stringify(result));
       },
       error: function (e) {
        alert(e);
       }
       });

Aucun commentaire:

Enregistrer un commentaire