// Creates local "temporary" object for holding employee data
var newTrain = {
tname: trainName,
dest: destination,
firstTime: firstTrainTime,
freq: frequency
};
// Uploads train data to the database
trainDataBase.ref().push(newTrain);
THIS IS THE PART I CAN"T figure out how do I get a key for the object I just created on the server? I tired the below but it comes back undefined, also also tired var = newKey = trainDatabase.ref.push(newTrain).key but then it creates to object versus one but I do get a key
// newKey = trainDataBase.ref(newTrain).key
// console.log("nodeKey" , newKey)
// Alert
console.log("train successfully added");
// Clears all of the text-boxes
$("#trainName").val("");
$("#destination").val("");
$("#firstTrainTime").val("");
$("#frequency").val("");
// Prevents moving to new page
return false;
});