Retrieving data in realtime from firebase


#1

Hi,

I am learning fire with web but I am able to retrieve the data in real time but how can I edit this data and then update it, not able to understand that parT I tried the code below but to no use, I intend to load data into text boxes and then make them editable by clicking on the text box.

Any help is appreciated.

Thanks

SAVING DATA TO FIREBASE :


var registration = firebase.database().ref("REGISTRATION");
var dataRef = firebase.database().ref("REGISTRATION");
var ref = firebase.database().ref("REGISTRATION");
var key;

function updatedtable()
{
    dataRef.on("child_added", function(data){
    var rData = data.val();
    $("#append").append("<tr><td>" + rData.name + "</td><td>" + rData.email + "</td><td>" + rData.gender + "</td><td>" + rData.birthdate + "</td><td>" + rData.phone + "</td><td>" + rData.state + "</td><td>" + rData.school + "</td><td>" + rData.class + "</td><td>" + rData.classname + "</td></tr>");
});
   
}
// Saving data to firebase DB
function dbsave (){

  var email = $("#email").val();
  var name = $("#name").val();
  var password = $("#password").val();
  var genval = $("#gender").val();
  var birthdate = $("#birthdate").val();
  var phone = $("#phone").val();
  var state = $("#state").val();    
  var school = $("#school").val();
  var clas = $("#clas").val();
  var classname = $("#classname").val();
    
registration.push({
    email: email,
    name: name,
    password: password,
    gender: genval,
    birthdate: birthdate,
    phone: phone,
    state: state,
    school: school,
    class: clas,
    classname: classname
})
    alert("Data Saved Successfully");
    init();
    }

#2

You can insert the new data using update just the way you could in a phpMyAdmin database,

More info here:

https://firebase.google.com/docs/database/admin/save-data