Can't figure out what syntax error is stopping Firebase from receiving my real-time data [duplicate]
This question already has an answer here:
Stop form refreshing page on submit
15 answers
prevent refresh of page when button inside form clicked
11 answers
My Firebase is not receiving my apps info. That's all. I am trying to send app data (newTrain) to firebase and it is not coming through. I have used Firebase once before and it took me some time to get it working.
Tried changing many things around to no prevail.
var config = {
apiKey: "AI***ZE",
authDomain: "train-operation-82774.firebaseapp.com",
databaseURL: "https://train-operation-82774.firebaseio.com",
projectId: "train-operation-82774",
storageBucket: "train-operation-82774.appspot.com",
messagingSenderId: "912678311822"
};
firebase.initializeApp(config);
var database = firebase.database();
$("#submit-train").on("click", function() {
$("#list").empty();
var trainName = $("#train-name-input").val().trim();
var trainDestination = $("#destination-input").val().trim();
var trainFirstTime = $("#firstTrain-input").val().trim();
var trainFrequency = $("#frequency-input").val().trim();
var newTrain = {
trainName: trainName,
trainDestination: trainDestination,
trainFirstTime: trainFirstTime,
trainFrequency: trainFrequency
};
console.log(newTrain);
database.ref().push(newTrain);
});
database.ref().on("child_added", function(childSnapshot) {
// console.log(childSnapshot.val());
var trainName = childSnapshot.val().trainName;
var trainDestination = childSnapshot.val().trainDestination;
var trainFirstTime = childSnapshot.val().trainFirstTime;
var trainFirstTime = childSnapshot.val().trainFirstTime;
console.log(trainName);
console.log(trainDestination);
console.log(trainFirstTime);
console.log(trainFrequency);
var trainFirstTimePretty = moment.unix(trainFirstTime).format("MM/DD/YYYY" + "HH:MM:SS");
var nextTrain = trainFirstTimePretty + trainFrequency;
console.log(nextTrain);
var newRow = $("<tr>").append(
$("<td>").text(trainName),
$("<td>").text(trainDestination),
$("<td>").text(trainFirstTimePretty),
$("<td>").text(trainFrequency),
$("<td>").text(nextTrain),
);
$("#taingSchedule-table > tbody").append(newRow);
});
javascript firebase-realtime-database
marked as duplicate by Doug Stevenson, Phil
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 3 at 1:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
show 9 more comments
This question already has an answer here:
Stop form refreshing page on submit
15 answers
prevent refresh of page when button inside form clicked
11 answers
My Firebase is not receiving my apps info. That's all. I am trying to send app data (newTrain) to firebase and it is not coming through. I have used Firebase once before and it took me some time to get it working.
Tried changing many things around to no prevail.
var config = {
apiKey: "AI***ZE",
authDomain: "train-operation-82774.firebaseapp.com",
databaseURL: "https://train-operation-82774.firebaseio.com",
projectId: "train-operation-82774",
storageBucket: "train-operation-82774.appspot.com",
messagingSenderId: "912678311822"
};
firebase.initializeApp(config);
var database = firebase.database();
$("#submit-train").on("click", function() {
$("#list").empty();
var trainName = $("#train-name-input").val().trim();
var trainDestination = $("#destination-input").val().trim();
var trainFirstTime = $("#firstTrain-input").val().trim();
var trainFrequency = $("#frequency-input").val().trim();
var newTrain = {
trainName: trainName,
trainDestination: trainDestination,
trainFirstTime: trainFirstTime,
trainFrequency: trainFrequency
};
console.log(newTrain);
database.ref().push(newTrain);
});
database.ref().on("child_added", function(childSnapshot) {
// console.log(childSnapshot.val());
var trainName = childSnapshot.val().trainName;
var trainDestination = childSnapshot.val().trainDestination;
var trainFirstTime = childSnapshot.val().trainFirstTime;
var trainFirstTime = childSnapshot.val().trainFirstTime;
console.log(trainName);
console.log(trainDestination);
console.log(trainFirstTime);
console.log(trainFrequency);
var trainFirstTimePretty = moment.unix(trainFirstTime).format("MM/DD/YYYY" + "HH:MM:SS");
var nextTrain = trainFirstTimePretty + trainFrequency;
console.log(nextTrain);
var newRow = $("<tr>").append(
$("<td>").text(trainName),
$("<td>").text(trainDestination),
$("<td>").text(trainFirstTimePretty),
$("<td>").text(trainFrequency),
$("<td>").text(nextTrain),
);
$("#taingSchedule-table > tbody").append(newRow);
});
javascript firebase-realtime-database
marked as duplicate by Doug Stevenson, Phil
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 3 at 1:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I'm thinking that I am having a syntax issue. Which is why the code isnt working.
– Antonio Foushee
Jan 3 at 0:49
What sort of element is#submit-train
? Is it a submit button? Is it in a<form>
?
– Phil
Jan 3 at 1:08
If you had a syntax error, it would appear in your browser's developer console. Are there any errors in your console?
– Phil
Jan 3 at 1:08
1
Yes there is. Its a moment.js error. Would that be stopping the rest of the operation? I guess it is first. af.js:11 Uncaught TypeError: Cannot read property 'defineLocale' of undefined at af.js:11 at af.js:7 at af.js:8 firebase.js:1
– Antonio Foushee
Jan 3 at 1:13
Would having my html help?
– Antonio Foushee
Jan 3 at 1:14
|
show 9 more comments
This question already has an answer here:
Stop form refreshing page on submit
15 answers
prevent refresh of page when button inside form clicked
11 answers
My Firebase is not receiving my apps info. That's all. I am trying to send app data (newTrain) to firebase and it is not coming through. I have used Firebase once before and it took me some time to get it working.
Tried changing many things around to no prevail.
var config = {
apiKey: "AI***ZE",
authDomain: "train-operation-82774.firebaseapp.com",
databaseURL: "https://train-operation-82774.firebaseio.com",
projectId: "train-operation-82774",
storageBucket: "train-operation-82774.appspot.com",
messagingSenderId: "912678311822"
};
firebase.initializeApp(config);
var database = firebase.database();
$("#submit-train").on("click", function() {
$("#list").empty();
var trainName = $("#train-name-input").val().trim();
var trainDestination = $("#destination-input").val().trim();
var trainFirstTime = $("#firstTrain-input").val().trim();
var trainFrequency = $("#frequency-input").val().trim();
var newTrain = {
trainName: trainName,
trainDestination: trainDestination,
trainFirstTime: trainFirstTime,
trainFrequency: trainFrequency
};
console.log(newTrain);
database.ref().push(newTrain);
});
database.ref().on("child_added", function(childSnapshot) {
// console.log(childSnapshot.val());
var trainName = childSnapshot.val().trainName;
var trainDestination = childSnapshot.val().trainDestination;
var trainFirstTime = childSnapshot.val().trainFirstTime;
var trainFirstTime = childSnapshot.val().trainFirstTime;
console.log(trainName);
console.log(trainDestination);
console.log(trainFirstTime);
console.log(trainFrequency);
var trainFirstTimePretty = moment.unix(trainFirstTime).format("MM/DD/YYYY" + "HH:MM:SS");
var nextTrain = trainFirstTimePretty + trainFrequency;
console.log(nextTrain);
var newRow = $("<tr>").append(
$("<td>").text(trainName),
$("<td>").text(trainDestination),
$("<td>").text(trainFirstTimePretty),
$("<td>").text(trainFrequency),
$("<td>").text(nextTrain),
);
$("#taingSchedule-table > tbody").append(newRow);
});
javascript firebase-realtime-database
This question already has an answer here:
Stop form refreshing page on submit
15 answers
prevent refresh of page when button inside form clicked
11 answers
My Firebase is not receiving my apps info. That's all. I am trying to send app data (newTrain) to firebase and it is not coming through. I have used Firebase once before and it took me some time to get it working.
Tried changing many things around to no prevail.
var config = {
apiKey: "AI***ZE",
authDomain: "train-operation-82774.firebaseapp.com",
databaseURL: "https://train-operation-82774.firebaseio.com",
projectId: "train-operation-82774",
storageBucket: "train-operation-82774.appspot.com",
messagingSenderId: "912678311822"
};
firebase.initializeApp(config);
var database = firebase.database();
$("#submit-train").on("click", function() {
$("#list").empty();
var trainName = $("#train-name-input").val().trim();
var trainDestination = $("#destination-input").val().trim();
var trainFirstTime = $("#firstTrain-input").val().trim();
var trainFrequency = $("#frequency-input").val().trim();
var newTrain = {
trainName: trainName,
trainDestination: trainDestination,
trainFirstTime: trainFirstTime,
trainFrequency: trainFrequency
};
console.log(newTrain);
database.ref().push(newTrain);
});
database.ref().on("child_added", function(childSnapshot) {
// console.log(childSnapshot.val());
var trainName = childSnapshot.val().trainName;
var trainDestination = childSnapshot.val().trainDestination;
var trainFirstTime = childSnapshot.val().trainFirstTime;
var trainFirstTime = childSnapshot.val().trainFirstTime;
console.log(trainName);
console.log(trainDestination);
console.log(trainFirstTime);
console.log(trainFrequency);
var trainFirstTimePretty = moment.unix(trainFirstTime).format("MM/DD/YYYY" + "HH:MM:SS");
var nextTrain = trainFirstTimePretty + trainFrequency;
console.log(nextTrain);
var newRow = $("<tr>").append(
$("<td>").text(trainName),
$("<td>").text(trainDestination),
$("<td>").text(trainFirstTimePretty),
$("<td>").text(trainFrequency),
$("<td>").text(nextTrain),
);
$("#taingSchedule-table > tbody").append(newRow);
});
This question already has an answer here:
Stop form refreshing page on submit
15 answers
prevent refresh of page when button inside form clicked
11 answers
javascript firebase-realtime-database
javascript firebase-realtime-database
edited Jan 3 at 4:17
Undo♦
23.1k2091116
23.1k2091116
asked Jan 3 at 0:26


Antonio FousheeAntonio Foushee
11
11
marked as duplicate by Doug Stevenson, Phil
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 3 at 1:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Doug Stevenson, Phil
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 3 at 1:38
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I'm thinking that I am having a syntax issue. Which is why the code isnt working.
– Antonio Foushee
Jan 3 at 0:49
What sort of element is#submit-train
? Is it a submit button? Is it in a<form>
?
– Phil
Jan 3 at 1:08
If you had a syntax error, it would appear in your browser's developer console. Are there any errors in your console?
– Phil
Jan 3 at 1:08
1
Yes there is. Its a moment.js error. Would that be stopping the rest of the operation? I guess it is first. af.js:11 Uncaught TypeError: Cannot read property 'defineLocale' of undefined at af.js:11 at af.js:7 at af.js:8 firebase.js:1
– Antonio Foushee
Jan 3 at 1:13
Would having my html help?
– Antonio Foushee
Jan 3 at 1:14
|
show 9 more comments
I'm thinking that I am having a syntax issue. Which is why the code isnt working.
– Antonio Foushee
Jan 3 at 0:49
What sort of element is#submit-train
? Is it a submit button? Is it in a<form>
?
– Phil
Jan 3 at 1:08
If you had a syntax error, it would appear in your browser's developer console. Are there any errors in your console?
– Phil
Jan 3 at 1:08
1
Yes there is. Its a moment.js error. Would that be stopping the rest of the operation? I guess it is first. af.js:11 Uncaught TypeError: Cannot read property 'defineLocale' of undefined at af.js:11 at af.js:7 at af.js:8 firebase.js:1
– Antonio Foushee
Jan 3 at 1:13
Would having my html help?
– Antonio Foushee
Jan 3 at 1:14
I'm thinking that I am having a syntax issue. Which is why the code isnt working.
– Antonio Foushee
Jan 3 at 0:49
I'm thinking that I am having a syntax issue. Which is why the code isnt working.
– Antonio Foushee
Jan 3 at 0:49
What sort of element is
#submit-train
? Is it a submit button? Is it in a <form>
?– Phil
Jan 3 at 1:08
What sort of element is
#submit-train
? Is it a submit button? Is it in a <form>
?– Phil
Jan 3 at 1:08
If you had a syntax error, it would appear in your browser's developer console. Are there any errors in your console?
– Phil
Jan 3 at 1:08
If you had a syntax error, it would appear in your browser's developer console. Are there any errors in your console?
– Phil
Jan 3 at 1:08
1
1
Yes there is. Its a moment.js error. Would that be stopping the rest of the operation? I guess it is first. af.js:11 Uncaught TypeError: Cannot read property 'defineLocale' of undefined at af.js:11 at af.js:7 at af.js:8 firebase.js:1
– Antonio Foushee
Jan 3 at 1:13
Yes there is. Its a moment.js error. Would that be stopping the rest of the operation? I guess it is first. af.js:11 Uncaught TypeError: Cannot read property 'defineLocale' of undefined at af.js:11 at af.js:7 at af.js:8 firebase.js:1
– Antonio Foushee
Jan 3 at 1:13
Would having my html help?
– Antonio Foushee
Jan 3 at 1:14
Would having my html help?
– Antonio Foushee
Jan 3 at 1:14
|
show 9 more comments
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm thinking that I am having a syntax issue. Which is why the code isnt working.
– Antonio Foushee
Jan 3 at 0:49
What sort of element is
#submit-train
? Is it a submit button? Is it in a<form>
?– Phil
Jan 3 at 1:08
If you had a syntax error, it would appear in your browser's developer console. Are there any errors in your console?
– Phil
Jan 3 at 1:08
1
Yes there is. Its a moment.js error. Would that be stopping the rest of the operation? I guess it is first. af.js:11 Uncaught TypeError: Cannot read property 'defineLocale' of undefined at af.js:11 at af.js:7 at af.js:8 firebase.js:1
– Antonio Foushee
Jan 3 at 1:13
Would having my html help?
– Antonio Foushee
Jan 3 at 1:14