Here is the code for my polymer form and JavaScript. It works well in pushing data. What I would like to achieve is a way to verify if the push operation was successful or not. If it was successful, I want to hide the form and display a confirmation message, or redirect users to another page.
My question is: How can I check if a Firebase push request was successful?
<form is="iron-form" method="get" action="firebaseURL/events" id="eventsDemo">
<paper-input name="name" label="Name" required auto-validate></paper-input>
<paper-input name="password" label="Password" type="password" required auto-validate></paper-input>
<paper-checkbox name="read" required>You must check this box</paper-checkbox><br>
<paper-button raised onclick="_delayedSubmit(event)" disabled id="eventsDemoSubmit">
<paper-spinner id="spinner" hidden></paper-spinner>Submit</paper-button>
<div class="output"></div>
</form>
<script>
function _delayedSubmit(event) {
event.preventDefault();
spinner.active = true;
spinner.hidden = false;
eventsDemoSubmit.disabled = true;
// Simulate a slow server response.
setTimeout(function() {
//Polymer.dom(event).localTarget.parentElement.submit();
var firebase = new Firebase(eventsDemo.getAttribute('action'));
firebase.push(eventsDemo.serialize());
}, 100);
}
</script>