Why is the webSQL reading not executed?

0

I have this js on an asp page:

<script type="text/javascript">
    function onSend() {            
        debugger;
        var paciente = {}
        var result = null; 
        paciente.nhc = "151617";
        result = getfingerPrint(paciente.nhc)          
        var huellas = result; 
        var objPaciente = {};
        objPaciente.paciente = paciente;
        objPaciente.huellas = huellas;
        var data = JSON.stringify(objPaciente);
        $.ajax(
            {
                type: "POST",
                url: "RegistroHuellas.aspx/EnrrollingPatient",
                data: data,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var names = response.d;
                    alert(names);
                },
                failure: function (response) {
                    alert(response.d);
                }
            });
    }
 </script>

the script sends to a webmethod a JSON, which is created from information retrieved from a webSQL, previously created, the information is recovered with this js:

function getfingerPrint(nhc)
{
    db = openDB();
    var strHuellass = null;
    db.transaction(function (t) {
        t.executeSql("SELECT * FROM huellas where nhc=?", [nhc],
            function (tran, r)
            {                
                for (var i = 0; i < r.rows.length; i++) {
                    var nhc = r.rows.item(i).nhc;
                    var huella = r.rows.item(i).huella;
                    strHuellass = strHuellass +  ' | '+huella;
                }
                return strHuellass
            },
            function (t, e) { alert("Error:" + e.message); }
        );
    });
}

The problem is that the following ... I can not get the reading of this line of code: "result = getfingerPrint (patient.nhc)" I returned the list of readings made to the DB, these after getting them I need transform them to a JSON.

What I need to be able to get the readings of the webSQL ??

    
asked by Emerson Rios 06.06.2018 в 04:08
source

0 answers