lundi 25 janvier 2016

Websql-fetch data and send them to other table

This is my code to fetch data from websql

function display(){
mydb.transaction(function(law){

  law.executeSql('select id,tag,title,description from laws',[],function(law,results){
    var n=results.rows.length;
    var s = '<table class="table table-bordered">';
      for( var j=0;j<n;j++){
        var law = results.rows.item(j);
        s+='<tr>';
          s+='<td>'+law.id+'</td>';
          s+='<td>'+law.tag+'</td>';
          s+='<td>'+law.title+'</td>';
          s+='<td>'+law.description+'</td>';
          s+='<td>'+'<a type="submit" class="btn btn-default" onclick="addLaw()">Submit</a>'+'</td>';
        s+='</tr>';

    }
  s+='</table>';
    document.getElementById('results').innerHTML=s;
  });
});

}

There is a submit button. What will will be my function definition to send data to other table by clicking that submit button.

Aucun commentaire:

Enregistrer un commentaire