jquery var for firebase database path

31 views Asked by At
//this is short hand not actual code please

var =  trainNum = 0;

// on button click

trainNum++;

// I can't figure out the format to put in so that firebase treats trainNum as the variable and not a string.
 database.ref(Trains/**I WANT THIS TO EQUAL THE trainNum as it increments **).push({
});

//Train number is being stored in database I don't know if this will effect outcome. 
1

There are 1 answers

7
Muhaki On

You have to get the trainNum from database, and not set it to 0.

Im not sure if that was your question?