Created
December 10, 2014 01:16
-
-
Save rdallaire/35092654b95dc7c67e83 to your computer and use it in GitHub Desktop.
firebase get data
This file contains hidden or 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://cdn.firebase.com/js/client/2.0.4/firebase.js'></script> | |
<script> | |
// var fb = new Firebase("https://sizzling-heat-3015.firebaseio.com/"); | |
// fb.set({ name: "Alex bob" }); | |
// fb.on("value", function(data) { | |
// var name = data.val() ? data.val().name : ""; | |
// alert("My name is " + name); | |
// Get a reference to our posts | |
var ref = new Firebase("https://docs-examples.firebaseio.com/web/saving-data/fireblog/posts"); | |
// Attach an asynchronous callback to read the data at our posts reference | |
ref.on("value", function(snapshot) { | |
console.log(snapshot.val()); | |
}, function (errorObject) { | |
console.log("The read failed: " + errorObject.code); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment