Created
December 10, 2012 08:55
-
-
Save diyism/4249425 to your computer and use it in GitHub Desktop.
insert tables into firebase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://static.firebase.com/v0/firebase.js"></script> | |
<script> | |
var ref=new Firebase('https://diyism.firebaseio.com/'); | |
ref.set({'tb_users':{'1':{'username':'Jack','password':'0data!'}, | |
'2':{'username':'Andy','password':'1data!'}, | |
'3':{'username':'Bob','password':'2data!'}, | |
}, | |
'tb_stocks':{'1':{'goods_num':'KK0245MM08-804-M', 'quantity':98}, | |
'2':{'goods_num':'KK0172YY02-990-L', 'quantity':18}, | |
'3':{'goods_num':'KK2104MM681-990-XXL', 'quantity':20} | |
}, | |
'tb_orders':{'1':{'username':'Andy', 'goods_id':3, 'quantity':1, 'time':'2012-11-29 11:01:01'}, | |
'2':{'username':'Bob', 'goods_id':2, 'quantity':1, 'time':'2012-11-29 11:02:01'}, | |
} | |
} | |
); | |
ref.once('value', function(data) | |
{console.log(data.child('tb_users/2/username').val()); | |
} | |
); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment