0

the following code does not save to my firebase. alert called1 is called but not called2 and I don't get the other 2 alerts. $("#registerButton").click(function(){ alert( "called1");

    ref.createUser({

        //email    : $("#txtEmail").val().text(),
        //password : $("#txtPass").val().text()
        email    : "test1",
        password : "test2"
    }, function(error, userData) {
                              alert( "called2");

    if (error) {
            console.log("Error creating user:", error);
                  alert( "error");

    } else {
            console.log("Successfully created user account with uid:", userData.uid);
                                  //alert( "Successfully created user account with uid:" + userData.uid);

    }
    });

});

I made it much simpler and it still does not work:

$(document).ready(function(){

$("#registerButton").click(function(){

    ref.createUser({
        email    : "Sbobtony@firebase.com",
        password : "correcthorsebatterystaple"
    }, function(error, userData) {

    if (error) {
            console.log("Error creating user:", error);

    } else {
            console.log("Successfully created user account with uid:", userData.uid);

    }
    });
});

});

  • sorry, this should be in the first line of code: $("#registerButton").click(function(){ alert( "called1"); and I don't get the "successfully created ..." alert even when it isn't commented – androidbrogrammer Mar 04 '15 at 23:50
  • possible duplicate of [Difference between val() and text()](http://stackoverflow.com/questions/807867/difference-between-val-and-text) – Frank van Puffelen Mar 05 '15 at 14:46

1 Answers1

0

The problem is the .val().text(), this is incorrect, .val() works well.

Difference between val() and text()

Community
  • 1
  • 1