Your problem most probably comes from the fact that your form is submitted before the Firebase set()
method is triggered.
As a matter of fact, you declare your button as follows:
<form id="add-location-form">
// ...
<button id="addLocation-btn" onclick="storeData()">Add</button>
</form>
i.e. without any type
attribute.
As detailed in the W3 specification on button types, “the missing value default is the Submit Button state” and “if the type attribute is in the Submit Button state, the element is specifically a submit button”.
So, if you add a button type to your button, as follows, it should solve your problem.
<button type="button" id="addLocation-btn" onclick="storeData()">Add</button>
CLICK HERE to find out more related problems solutions.