function addUserToDatabase(){
        var email = txt_email.val().replace(/\./g, "+");        
        var date = new Date();
        var registrationDate = months[date.getMonth()] + " " + date.getDate() + ', ' + date.getFullYear();

        var user = {
            firstName: $('#f-name').val(),
            lastName: $('#l-name').val(),
            email: email,
            regDate: registrationDate,
            country: "",
            state: "",
            city: "",
            postalCode: "",
        }

        var db = firebase.firestore();
        db.collection("Users").doc(email).set(user)
            .then(function() {
                console.log("Document successfully written!");
            })
            .catch(function(error) {
                console.error("Error writing document: ", error);
            });
        }
// put the user in the database
put the user in the database
put the user in the database
function addUserToDatabase(){
        var email = txt_email.val().replace(/\./g, "+");        
        var date = new Date();
        var registrationDate = months[date.getMonth()] + " " + date.getDate() + ', ' + date.getFullYear();
        var user = {
            firstName: $('#f-name').val(),
            lastName: $('#l-name').val(),
            email: email,
            regDate: registrationDate,
            country: "",
            state: "",
            city: "",
            postalCode: "",
        }
        var db = firebase.firestore();
        db.collection("Users").doc(email).set(user)
            .then(function() {
                console.log("Document successfully written!");
            })
            .catch(function(error) {
                console.error("Error writing document: ", error);
            });
        }
function addUserToDatabase ( ) { var email = txt_email . val ( ) . replace ( / \. / g , "+" ) ; var date = new Date ( ) ; var registrationDate = months [ date . getMonth ( ) ] + " " + date . getDate ( ) + ', ' + date . getFullYear ( ) ; var user = { firstName : $ ( '#f-name' ) . val ( ) , lastName : $ ( '#l-name' ) . val ( ) , email : email , regDate : registrationDate , country : "" , state : "" , city : "" , postalCode : "" , } var db = firebase . firestore ( ) ; db . collection ( "Users" ) . doc ( email ) . set ( user ) . then ( function ( ) { console . log ( "Document successfully written!" ) ; } ) . catch ( function ( error ) { console . error ( "Error writing document: " , error ) ; } ) ; }
put the user in the database
put the user in the database