-2

I cannot find a solution for passing JS variable value (text) into websql DB .. All i keep finding is some PHP solutions and I do not want to use it.

function store(){
    var x = document.getElementById('inp1').value;
    names.push(x);
    L10();
    $('#tt').text(names);
}


function Insert(){
    db.transaction(function(t){
    t.executeSql('INSERT INTO Followers(fNAME) VALUES (?)',[x]);//->here is my problem :) x variable
    });
}
$('#inp2').click(function(){

    store();

    Insert();
});
GoranCrO
  • 19
  • 6

1 Answers1

0

Found my error ,I used private variable x instead of global x .. duh!

x = document.getElementById('inp1').value;
GoranCrO
  • 19
  • 6